Difference between revisions of "Share.share"
From GiderosMobile
| Line 4: | Line 4: | ||
| === Description === | === Description === | ||
| − | + | Sharing a piece of data with an external app. | |
| <syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
| Share.share(mimeType,data) | Share.share(mimeType,data) | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | This invokes the platform default sharing dialog, allowing to save, print, send, share, etc. | ||
| Supported MIME types: | Supported MIME types: | ||
Revision as of 17:29, 18 February 2025
Available since: Gideros 2020.7
Class: Share
Description
Sharing a piece of data with an external app.
Share.share(mimeType,data)
This invokes the platform default sharing dialog, allowing to save, print, send, share, etc.
Supported MIME types:
- "text/*"
- "image/png"
- "image/jpeg"
Parameters
mimeType: (string) the MIME type of the data
data: (string) the data itself
Example
local b = Buffer.new("diploma.jpg")
rt:save("|B|diploma.jpg")
local bdata = b:get()
b = nil
collectgarbage()
print("DIPLOMA:", #bdata)
local ok, share = pcall(function() return require "Share" end)
if ok then
--	Analytics("diploma_share")
	share.share("image/jpeg", bdata)
end
