java.lang.Object | |
↳ | co.megacool.megacool.ShareConfig |
ShareConfig enables you to customize the share created, to link to a specific section in your game, or add additional data for analytics.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ShareConfig()
Build a new empty ShareConfig.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ShareConfig |
data(Map<String, Object> data)
Set extra data to attach to the share.
| ||||||||||
ShareConfig |
dataAsJson(String data)
Set extra data to attach to the share using a JSON formatted String.
| ||||||||||
ShareConfig |
fallbackImage(int fallbackImage)
An image that will be shared if there's no frames recorded yet, or the gif creation
fails for some reason.
| ||||||||||
ShareConfig |
fallbackImageAsset(String fallbackImageAsset)
An image that will be shared if there's no frames recorded yet, or the gif creation
fails for some reason.
| ||||||||||
Map<String, Object> |
getData()
Get the share's extra data.
| ||||||||||
int |
getFallbackImage()
Get the share's fallback image, or
0 if not set. | ||||||||||
String |
getFallbackImageAsset()
Get the path to the share's fallback image, or
null if not set. | ||||||||||
String |
getMessage()
Get the share's predefined message.
| ||||||||||
String |
getModalTitle()
Get the title of the share modal.
| ||||||||||
String |
getRecordingId()
Get the identifier of the recording that will be shared.
| ||||||||||
SharingStrategy |
getStrategy()
Get the share's sharing strategy.
| ||||||||||
Uri |
getUrl()
Get the custom url for the share, or
null if none is set. | ||||||||||
void | instrument(JsonObject object, String key) | ||||||||||
ShareConfig |
message(String message)
Set the predefined message that's used when calling
share(Activity) | ||||||||||
ShareConfig |
modalTitle(String modalTitle)
Set the title of the modal that presents the apps the user can share to.
| ||||||||||
ShareConfig |
recordingId(String recordingId)
Which recording to share.
| ||||||||||
ShareConfig |
strategy(SharingStrategy strategy)
Set the
SharingStrategy to be used when sharing to apps that support text or
media, but not both. | ||||||||||
String | toString() | ||||||||||
ShareConfig |
url(Uri url)
The URL path to share.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Build a new empty ShareConfig.
Set extra data to attach to the share.
This can be used to include extra, trusted data in the share that is not visible in the URL. Note that even though the data is not immediately visible to the user like the URL is, it is not suitable for storing any sort of secret data, anyone with the URL of a share can get access to its data.
data | Data to include in the share. Must be encodable as JSON, thus no complex types. |
---|
Set extra data to attach to the share using a JSON formatted String.
This offers the same functionality as data(Map)
, but with a String
argument to make it more convenient to use for Unity, etc.
data | Data to include in the share. Must be encodable as JSON. |
---|
An image that will be shared if there's no frames recorded yet, or the gif creation fails for some reason.
fallbackImage | an image that will be shared if there is no gif |
---|
An image that will be shared if there's no frames recorded yet, or the gif creation fails for some reason.
The asset can be either an image file or a .gif.
fallbackImageAsset | the name of an asset that will be shared if there is no gif |
---|
Get the share's extra data.
Get the share's fallback image, or 0
if not set.
Get the path to the share's fallback image, or null
if not set.
null
.
Get the share's predefined message.
Get the title of the share modal.
Get the identifier of the recording that will be shared.
Get the share's sharing strategy.
Get the custom url for the share, or null
if none is set.
This does not include the referral code that will be included when shared.
null
.
Set the predefined message that's used when calling share(Activity)
message | The sharing text |
---|
Set the title of the modal that presents the apps the user can share to.
The default is "Share GIF"
.
modalTitle | the title of the share modal |
---|
Which recording to share. Only needed if you set a recordingId during capture.
recordingId | the recordingId used when recording |
---|
Set the SharingStrategy
to be used when sharing to apps that support text or
media, but not both. Defaults to LINK
The URL path to share.
You can encode any data you want into the URL parameters to ensure
they are available to the recipient immediately when they open the app, as
getUrl()
.
Note that only the path, query and fragment are used. The absolute share url will be
https://<base-url><url>?_m=<referral-code>
.
The default base url is mgcl.co/<app-identifier>
, but can be changed with
baseUrl(Uri)
.