Share:export
From GiderosMobile
Available since: Gideros 2024.1
Class: Share
Description
Exporting a piece of data to the phone via default file application.
(bool) = Share:export(data,mimeType,filename)
This invokes the platform default file application.
Parameters
data: (varies) the data to export (text String or image data)
mimeType: (string) the MIME type of the exported data
filename: (string) the name the file will be saved to
Return values
Returns (boolean) true if data can be exported
Examples
Text
require "Share"
local share = Share.new()
share:export("Hello Gideros!", "text/plain" , "hello.txt") -- data, MIME type, file name
share:addEventListener(Event.SHARE_EXPORT_RESULT, function(e)
print("share:export callback:", e and e.status)
end)
Image
require "Share"
local share = Share.new()
local img = io.open("gfx/cat.jpg")
local rimg = img:read("*all")
share:export(rimg, "image/jpeg", "cat1.jpg") -- data, MIME type, file name
share:addEventListener(Event.SHARE_EXPORT_RESULT, function(e)
print("share:export callback:", e and e.status)
end)