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 70.

GetVersionName

Returns the version name of the adjoe SDK, for example 2.1.1.

HasAcceptedTOS

Returns true if the user has accepted the adjoe TOS and false otherwise.

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

Adjoe.DoPayout(AdjoePayoutSuccessListener, AdjoePayoutErrorListener);

public void AdjoePayoutSuccessListener(AdjoePayoutResponse response)
{
  // the payout was executed successfully

  //get the amount of paid out coins
  int paidOutCoins = response.Coins;
}

public void AdjoePayoutErrorListener(AdjoePayoutError error)
{
  // an error occurred while paying out the coins
          
  // get information about why it failed
  // 'reason' is one of
  //  - AdjoePayoutError.UNKNOWN
  //  - AdjoePayoutError.NOT_ENOUGH_COINS
  //  - AdjoePayoutError.TOS_NOT_ACCEPTED
  int reason = error.Reason;
  
  // if available, get more information about the error
  if (error.Exception != null) {
      Console.WriteLine(error.Exception.ToString());
  }
}

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 Adjoe.PAYOUT_TOS_NOT_ACCEPTED. You might want to forward to Playtime again so that the user can accept the adjoe Terms of Service. This operation will also fail with reason equal to Adjoe.PAYOUT_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:

AdjoeParams adjoeParams = new AdjoeParams();
adjoeParams.SetUaNetwork("network")
	   .SetUaChannel("Channel")
	   .SetUaSubPublisherCleartext("SubPublisherCleartext")
	   .SetUaSubPublisherEncrypted("SubPublisherEncrypted")
	   .SetPlacement("placement");
Adjoe.DoPayout(adjoeParams, AdjoePayoutSuccessListener, AdjoePayoutErrorListener);

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

Adjoe.RequestRewards(AdjoeRewardSuccess, AdjoeRewardError);

public void AdjoeRewardSucces(AdjoeRewardResponse response)
{
  // successfully requested the rewards
        
  // get the total amount of coins which the user has collected
  int reward = response.Reward;
  
  // get the amount of coins which are available for payout
  int availableForPayout = response.AvailablePayoutCoins;
  
  // get the amount of coins which the user has already spent
  int alreadySpentCoins = response.AlreadySpentCoins;
}

public void AdjoeRewardError(AdjoeRewardResponseError error)
{
  // an error occurred while requesting the rewards
        
  // you can try to get additional information about the error for debugging
  if (error.Exception != null) {
      Console.WriteLine(error.Exception.ToString());
  }
}

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:

AdjoeParams adjoeParams = new AdjoeParams();
adjoeParams.SetUaNetwork("network")
					.SetUaChannel("Channel")
					.SetUaSubPublisherCleartext("SubPublisherCleartext")
					.SetUaSubPublisherEncrypted("SubPublisherEncrypted")
					.SetPlacement("placement");
Adjoe.RequestRewards(adjoeParams, AdjoeRewardSuccess, AdjoeRewardError);

Last updated