Skip to main content
Version: 3.x.x

F.A.Q

Analytics

User need to accept EULA for analytics to work. If your project don't need authorize window and EULA window to be shown, please disable license_agreement_enabled and enable license_agreement_auto_accept parameters.

If license_agreement_enabled == false and license_agreement_auto_accept == true your analytics will be sended always without EULA window. But if license_agreement_enabled == true – auto accept will not work. Handle only user's Accept.

<meta-data android:name="com.platform101xp.sdk.license_agreement_enabled"
android:value="@bool/eula_show_enabled"/>
<meta-data android:name="com.platform101xp.sdk.license_agreement_auto_accept"
android:value="@bool/eula_auto_accept" />

Simple Guest Authorization

Simple Guest Authorization – for games that don't require full 101XP user authorization, but rather allow the game to be launched immediately with guest authorization, without any user interaction.

For simple guest authentication to work, the following flags must be enabled:

<meta-data
android:name="com.platform101xp.sdk.auto_login_enabled"
android:value="true" />
<meta-data
android:name="com.platform101xp.sdk.guest_enabled"
android:value="true"/>
<meta-data
android:name="com.platform101xp.sdk.guest_only_auth"
android:value="true" />

In addition, the following flags must be disabled:

<meta-data
android:name="com.platform101xp.sdk.guest_timeout_enabled"
android:value="false"/>
<meta-data android:name="com.platform101xp.sdk.google_auth_first_session"
android:value="false" />
<meta-data android:name="com.platform101xp.sdk.gp_enabled"
android:value="false"/>

If everything is done according to the instructions above, the user will be authorized as a guest and will be automatically logged in when called from the game client.

Platform101XP.authorize()

Important: Always check if you are already authorized before requesting authorization.

To do so, ask the MSDK for a token:

Platform101XP.getToken()

If the function returns null, only then call Platform101XP.authorize()

Native Billing Setup

To enable native mobile platform billing (Google Play billing) without using 101XP mobile billing, you must specify the following parameters:

<meta-data android:name="com.platform101xp.sdk.billing.enabled"
android:value="true"/>

List of lots for purchases

<meta-data android:name="com.platform101xp.sdk.billing.sku"
android:value="@string/billing_sku"/>

As well as a key to verify purchase validity

<meta-data android:name="com.platform101xp.sdk.billing.public_key"
android:value="@string/billing_public_key"/>

To make a purchase, you must request the purchase from MSDK using its ID:

//kotlin
val product = Platform101XP.getProductById("com.101xp.product")

And use it to call the purchase itself. The product and serverId parameters are strictly required.

//kotlin
KotlinPlatform101XP.purchaseProduct(product, serverId, properties)

Legend:

  • product – This is the item to be purchased.
  • serverId – This is the server ID where the reward will be credited. For games without a server, you still need to specify a fake ID for placeholder purposes (check with your Project Manager for the exact ID, or use '2000').
  • properties – A list of additional parameters that will be sent when sending the purchase data to our API. This parameter is optional.

Below are some clarifications about how 'non-consumable purchases' work on Android:

The Android Google Console does not have the concept of 'non-consumable purchases' itself. Therefore, all purchases are consumable. But all purchases have two stages:

  • Purchasing the item
  • Spending the item

For example, if you called Platform101XP.purchaseProduct(product, serverId, properties) and the user purchased the item, it will always be in the user's account data. When you call Platform101XP.restoreProducts(), the function will return the completed purchase and prevent the user from purchasing the item again until you forcefully call Platform101XP.finishPurchase(purchase). Then the item will be spent, and the Google billing server will no longer return this purchase when calling Platform101XP.restoreProducts().

Therefore, the action flow for 'non-spendable purchases' is to call Platform101XP.purchaseProduct and... that's it, and then restore if necessary.

For 'Consumable Purchases', when information is received from the MSDK that the item has been purchased in the main listener, we override the function onPurchaseProductResult(purchase: Platform101XPPurchase?, error: Platform101XPError?) and credit a reward to the user (or you don't need to do this if the server credits it itself) and then call Platform101XP.finishPurchase(Platform101XPPurchase purchase) to consume the lot so the user can buy it again.