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

local function payoutSuccessListener(response)
  -- the payout was executed successfully

  -- get the amount of paid out coins
  local paidOutCoins = response.coins
end

local function payoutErrorListener(error)

  -- an error occurred while paying out the coins
          
  -- get information about why it failed
  -- 'reason' is one of
  --  - Adjoe.PAYOUT_ERR_UNKNOWN
  --  - Adjoe.PAYOUT_ERR_NOT_ENOUGH_COINS
  --  - Adjoe.PAYOUT_ERR_TOS_NOT_ACCEPTED
  local reason = error.reason
  
  -- if available, get more information about the error
  if error.message ~= nil then
      print(error.message)
  end
end

Adjoe.DoPayout(nil, payoutSuccessListener, payoutErrorListener);

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:

local adjoeParams = Adjoe.NewAdjoeParams()
					:SetUANetwork("network")
					:SetUAChannel("channel")
					:SetUASubPublisherCleartext("SubPublisherCleartext")
					:SetUASubPublisherEncrypted("SubPublisherEncrypted")
					:SetPlacement("Test-placement")
					
Adjoe.DoPayout(adjoeParams, payoutSuccessListener, payoutErrorListener)

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

local function rewardSuccess(response)
  -- successfully requested the rewards
        
  -- get the total amount of coins which the user has collected
  local reward = response.rewards
  
  -- get the amount of coins which are available for payout
  local availableForPayout = response.availableCoins
  
  -- get the amount of coins which the user has already spent
  local alreadySpentCoins = response.alreadySpentCoins
end

local function rewardError(error)
  -- an error occurred while requesting the rewards
        
  -- you can try to get additional information about the error for debugging
  if error ~= nil then
      print(error)
  end
end

Adjoe.RequestRewards(nil, rewardSuccess, rewardError)

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:

local adjoeParams = Adjoe.NewAdjoeParams()
					:SetUANetwork("network")
					:SetUAChannel("channel")
					:SetUASubPublisherCleartext("SubPublisherCleartext")
					:SetUASubPublisherEncrypted("SubPublisherEncrypted")
					:SetPlacement("placement")
					
Adjoe.RequestRewards(adjoeParams, rewardSuccess, rewardError)w

Last updated