Other methods
There are some other methods in the adjoe SDK which you might find helpful.
name
description
getVersion
Returns the internal version code of the adjoe SDK, for example 17.
getVersionName
Returns the version name of the adjoe SDK, for example 1.2.0.
hasAcceptedTOS
Returns true if the user has accepted the adjoe TOS and false otherwise.
hasAcceptedUsagePermission
Returns true if the user has granted access to the app usage statistics and the adjoe SDK was initialized accordingly, false otherwise. Note that this method will always return true on devices with an Android API level smaller than 21.

Payout via SDK

The following information on SDK-side reward handling is only relevant for your integration if you cannot use Server-to-Server Payout. Do not implement these functions if you already successfully followed the steps in the Payout section - it could trigger error messages and unexpected behaviour.
If you cannot handle the payout requests via an endpoint on your server, we can also handle the reward payouts inside the SDK itself.
To pay out the rewards that the user has collected from partner apps directly in the SDK, call
1
window.AdjoePlugin.doPayout(
2
function(msg) {
3
// the payout was successful
4
5
// the the amount of coins which were paid out
6
var coins = msg['payout_coins'];
7
},
8
function(errMsg) {
9
// an error occurred while paying out the coins
10
11
// get the reason why it failed
12
var reason = errMsg['reason'];
13
14
// 'reason' is one of
15
// - window.AdjoePlugin.ERR_PAYOUT_NOT_ENOUGH: the user has not collected enough coins to pay out
16
// - window.AdjoePlugin.ERR_PAYOUT_TOS: the user has not accepted the adjoe Terms of Service
17
// - window.AdjoePlugin.ERR_PAYOUT_UNKNOWN: there is no detailed information about the error available
18
},
19
);
Copied!
This method always pays out all rewards which the user has collected, i.e. the value of rewards['available_payout_coins'].
If the user has not accepted the adjoe Terms of Service yet, this operation will fail and reason will be equal to window.AdjoePlugin.ERR_PAYOUT_TOS. You might want to display the offerwall again so that the user can accept the adjoe Terms of Service. This operation will also fail with reason equal to window.AdjoePlugin.ERR_PAYOUT_UNKNOWN if the user is blocked by the adjoe services.

Sub-IDs

You can pass two optional Sub-IDs when you pay out the rewards: window.AdjoePlugin.doPayoutWithSubIDs('<subId1>', '<subId2>', success, error).

Further Context on Rewards

You can get information about the rewards that the user has collected as well as about how many rewards are available for payout and how many the user has already spent.
To do so call
1
window.AdjoePlugin.getRewards(
2
function(msg) {
3
// successfully requested the rewards
4
5
// get the total amount of coins which the user has collected
6
var reward = msg['reward'];
7
8
// get the amount of coins which the user has already spent
9
var alreadySpentCoind = msg['already_spent_coins'];
10
11
// get the amount of coins which are available for payout
12
var availableForPayout = msg['available_for_payout'];
13
},
14
function(err) {
15
// an error occurred while requesting the rewards
16
},
17
);
Copied!
This operation will fail if the SDK is not initialized, the user has not accepted the adjoe Terms of Service or is blocked by the adjoe services.

Sub-IDs

You can pass two optional Sub-IDs when you request the rewards: window.AdjoePlugin.getRewardsWithSubIDs('<subId1>', '<subId2>', success, error).
Last modified 24d ago