Initialization
In order to access the functionalities of the AppsPrize Playtime SDK, it is necessary to perform an initialization process. To achieve this, simply make a call toAppsPrize.Initialize
when your app is starting.
The initialization will occur asynchronously in the main application process, running in the background. Upon completion, you will be notified through the AppsPrize.Initialize's
OnInitialize
or OnInitializedFailed
method, depending on the outcome.
OnRewardUpdate
: This function will let you know that the user has completed one or multiple rewards in a session.
Please make sure that "userId" and "token" have not an empty value. Also, "country" and "language" should be defined for country targeting. We need to get device locale into the SDK in order to fill the feed with relevant offers.
new AppsPrizeConfig(
token: TOKEN,
advertisingId: AD_ID,
userId: USER_ID,
country: "US",
language: "en",
// User Profile for better targeting.
gender: "MALE",
age: 30,
uaChannel: "uaChannel",
uaNetwork: "uaNetwork",
adPlacement: "adPlacement",
new AppsPrizeStyleConfig(
primaryColor: Color.blue,
secondaryColor: Color.black,
highlightColor: Color.green,
offersTitleText: "Test Offer",
appsTitleText: "Test Apps"
)
)
You can set the parameters in config object;
- String token: The SDK token that you can take it from the dashboard once you add your app.
- String userId: A custom user identifier that you give to your users. With the help of this ID, we will match the payouts to your users and inform you by server-to-server payout method.
Setting up AppsprizeListener
public class AppsPrizeCustomListener : IAppsPrizeListener {
//...
public void OnInitialize()
{
Debug.Log("[AppsPrize-Unity]: OnInitialize");
}
public void OnInitializeFailed(string errorMessage)
{
Debug.Log("[AppsPrize-Unity]: OnInitializeFailed");
}
public void OnRewardUpdate(List<AppRewards> rewards)
{
Debug.Log("[AppsPrize-Unity]: OnRewardUpdate: " + rewards.ToString());
}
public void OnNotification(List<AppsPrizeNotification> notifications)
{
Debug.Log("[AppsPrize-Unity]: OnNotification: " + notifications.ToString());
}
//...
}
//...
AppsPrize.Initialize(
appsPrizeConfig,
new AppsPrizeCustomListener()
);
//...
You need to listen to
OnInitializedFailed
once the user opens your app and not show the AppsPrize for these users. This event will be coming under the following conditions:
- Data load failed
- Network fail
- Corrupted data- App token not found
- Wrong region/country
Updated 8 days ago