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.init(Config)
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.init'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.
const appsPrizeConfig: AppsPrizeConfig = {
/// The token used for authentication.
token: "token";
// The advertising identifier used for tracking.
advertisingId: "adId";
// The user identifier.
userId: "userId";
// The country associated with the user.
country: "EN";
// The language preference of the user.
language: "en";
//User Profile for better targeting.
gender: "gender",
age: 30,
uaChannel: "uaChannel",
uaNetwork: "uaNetwork",
adPlacement: "adPlacement",
// (Optional) The styling configuration for UI customization.
style: AppsPrizeStyleConfig;
}
AppsPrize.init(config, {
onInitialize: (event) => {
console.log("AppsPrize:TS:onInitialize")
},
onInitializeFailed: (event) => {
console.log(`AppsPrize:TS:onInitializeFailed:${JSON.stringify(event)}`)
},
onRewardUpdate: (event) => {
console.log(`AppsPrize:TS:onRewardUpdate:${JSON.stringify(event)}`)
},
onNotification: (event) => {
console.log(`AppsPrize:TS:onNotification:${JSON.stringify(event)}`)
},
})
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.
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