Other methods
There are some other methods in the adjoe SDK which you might find helpful.
name
description
Adjoe.GetVersion
Returns the internal version code of the adjoe SDK, for example 17.
Adjoe.GetVersionName
Returns the version name of the adjoe SDK, for example 1.2.0.
Adjoe.HasAcceptedTOS
Returns true if the user has accepted the adjoe TOS and false otherwise.
Adjoe.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
local function payoutSuccessListener(response)
2
-- the payout was executed successfully
3
4
-- get the amount of paid out coins
5
local paidOutCoins = response.coins
6
end
7
8
local function payoutErrorListener(error)
9
10
-- an error occurred while paying out the coins
11
12
-- get information about why it failed
13
-- 'reason' is one of
14
-- - Adjoe.PAYOUT_ERR_UNKNOWN
15
-- - Adjoe.PAYOUT_ERR_NOT_ENOUGH_COINS
16
-- - Adjoe.PAYOUT_ERR_TOS_NOT_ACCEPTED
17
local reason = error.reason
18
19
-- if available, get more information about the error
20
if error.message ~= nil then
21
print(error.message)
22
end
23
end
24
25
Adjoe.DoPayout(nil, payoutSuccessListener, payoutErrorListener);
Copied!
This method always pays out all rewards which the user has collected, i.e. the value of rewards.availableForPayout.
If the user has not accepted the adjoe Terms of Service yet, this operation will fail and reason will be equal to Adjoe.PAYOUT_ERR_TOS_NOT_ACCEPTED. 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 Adjoe.PAYOUR_ERR_UNKNOWN if the user is blocked by the adjoe services.

Adjoe Parameters

You can pass additional UA and placement parameters when you pay out the rewards:
1
local adjoeParams = Adjoe.NewAdjoeParams()
2
:SetUANetwork("network")
3
:SetUAChannel("channel")
4
:SetUASubPublisherCleartext("SubPublisherCleartext")
5
:SetUASubPublisherEncrypted("SubPublisherEncrypted")
6
:SetPlacement("Test-placement")
7
8
Adjoe.DoPayout(adjoeParams, payoutSuccessListener, payoutErrorListener)
Copied!

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
local function rewardSuccess(response)
2
-- successfully requested the rewards
3
4
-- get the total amount of coins which the user has collected
5
local reward = response.rewards
6
7
-- get the amount of coins which are available for payout
8
local availableForPayout = response.availableCoins
9
10
-- get the amount of coins which the user has already spent
11
local alreadySpentCoins = response.alreadySpentCoins
12
end
13
14
local function rewardError(error)
15
-- an error occurred while requesting the rewards
16
17
-- you can try to get additional information about the error for debugging
18
if error ~= nil then
19
print(error)
20
end
21
end
22
23
Adjoe.RequestRewards(nil, rewardSuccess, rewardError)
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.

Adjoe Parameters

You can pass additional UA and placement parameters when you request the rewards:
1
local adjoeParams = Adjoe.NewAdjoeParams()
2
:SetUANetwork("network")
3
:SetUAChannel("channel")
4
:SetUASubPublisherCleartext("SubPublisherCleartext")
5
:SetUASubPublisherEncrypted("SubPublisherEncrypted")
6
:SetPlacement("placement")
7
8
Adjoe.RequestRewards(adjoeParams, rewardSuccess, rewardError)w
Copied!
Last modified 24d ago