Sending Viral Posts to Social Media Feed
This module allows the app to prompt users to share a viral post image/text on their social media feed.
This feature is Android-only. All settings are marked ๐ค.
Under the hood, the SDK uses Android intents to share content.
Configuration is done via the Settings Inspector in Unity.
Configuration is applied automatically at build time for each platform.
Platform markersโ
The following markers are used to indicate platform availability of parameters and features:
- (no marker) โ Shared parameter or feature
- ๐ โ iOS-specific parameter or feature
- ๐ค โ Android-specific parameter or feature
- โ ๏ธ โ Not implemented in the Unity plugin yet
Ask your release manager for the required parameters before configuring the SDK.
Configure ๐คโ
Configuration is done via the Settings Inspector.
| Field | Description |
|---|---|
| Viral Post Text ๐ค | Default text included in the shared viral post |
| Viral Post Image Path ๐ค | Path/URL to the image used for the viral post |
| Viral Post Enabled ๐ค | Enables/disables the โsend viral postโ feature |
These values must be set in the Unity Settings Inspector.
Usage (Unity / C#)โ
The SDK exposes a method to trigger a viral post share intent.
Send a Viral Postโ
// Uses default text and image configured in the Settings Inspector
P101XP.GetInstance().SendViralPost();
This will open the Android share intent with the configured post text and image.
Optional Overrides ๐คโ
If you want to override the text or image at runtime, you can pass arguments:
P101XP.GetInstance().SendViralPost(
text: "Check out my score!",
imagePath: "/sdcard/Android/data/.../viral_image.png"
);
Both parameters are optional; if omitted, the SDK uses defaults from the inspector.
Notesโ
- This feature is Android-only and depends on installed apps that can handle share intents.
- If no compatible app is installed, the share dialog may not appear.
- Images must be accessible by Android file providers (frequently via cache/temporary paths) for intents to share them.
Exampleโ
// Hook to a UI button
public void OnShareButtonClicked()
{
P101XP.GetInstance().SendViralPost(
text: "I just leveled up!",
imagePath: Application.persistentDataPath + "/share.png"
);
}
Once called, this opens the Android share dialog with the provided content.
Summaryโ
| Platform | Supported |
|---|---|
| Android ๐ค | โ๏ธ |
| iOS ๐ | โ ๏ธ (no official support documented) |