Difference between revisions of "Share:import"
From GiderosMobile
|  (Created page with "__NOTOC__ '''Available since:''' Gideros 2024.1<br/> '''Class:''' Share<br/>  === Description === Importing a piece of data via the phone default file application. <syntax...") | 
| (No difference) | 
Revision as of 18:07, 20 February 2025
Available since: Gideros 2024.1
Class: Share
Description
Importing a piece of data via the phone default file application.
(bool) = Share:import(mimeType,extension)
This invokes the platform default file application with the data filtered by extension.
Parameters
mimeType: (string) the MIME type of the data
extension: (string) the extension to use as filter
Return values
Returns (boolean) true if data can be imported
Example
require "Share"
local share = Share.new()
share:import("*/*" ,"jpg") -- MIME type, extension
local function decodeFileData(e)
	print("share:import callback:", e and e.status, e and e.mime, e and e.name)
	if e and e.status and e.status > 0 then
		print("Got Data:", #e.data)
	else
		print("Import failed")
	end
	share:removeEventListener(Event.SHARE_IMPORT_RESULT, decodeFileData)
end
share:addEventListener(Event.SHARE_IMPORT_RESULT, decodeFileData)
