Share API
Share API
Deprecated
The reward-based share API (ShareForReward) has been replaced by the unified rewarded slot and is kept for compatibility ([System.Obsolete] attribute — using it produces a compile warning). For new integrations, retrieve slots with GetRewardedAdSlots() and run them via ShowRewardedAd(slot) (action=SHARE).
ShareForReward(url, onSuccess, onFail)
Executes a reward-based share. The share UI and reward decision are handled by the platform; the SDK only receives the final result.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | - | URL to share (nullable) |
onSuccess | Action<ShareForRewardResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
Success Response (ShareForRewardResult):
| Field | Type | Description |
|---|---|---|
rewarded | bool | Whether reward was granted |
// Reward-based share
TudadaSDK.Instance.ShareForReward(
url: "https://example.com/share",
onSuccess: (result) => {
if (result.rewarded)
{
Debug.Log("Share complete - reward granted");
}
},
onFail: (err) => Debug.LogError("Share failed: " + err)
);
// Call without URL
TudadaSDK.Instance.ShareForReward(
onSuccess: (result) => Debug.Log("Rewarded: " + result.rewarded)
);