Skip to main content
Version: Next

F.A.Q

Analytics

For work analytics need accept eula, if your project not need authorize and eula dialog, please disable license_agreement_enabled and enable license_agreement_auto_accept

If license_agreement_enabled == false and license_agreement_auto_accept == true your analytics be send always without EULA window but if license_agreement_enabled == true auto accept not working. Only handle 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

This is for games where authorization is not required in general. Enable the Following Flags

<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" />

Disable the Following Flags

<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"/>

In this case, authorization will only be as a guest and will occur automatically by calling Platform101XP.authorize() from the client. Also, always check if you are already authorized before requesting authorization. Request the token from the SDK using Platform101XP.getToken(). If the function returns null, only then call Platform101XP.authorize().

Native Billing Setup

To enable native billing, you need to specify the 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"/>

And the key for validating the purchase:

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

To make a purchase, request the purchase from the SDK by its ID:

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

And use it to initiate the purchase itself. Required parameters: product and serverId

//kotlin
KotlinPlatform101XP.purchaseProduct(product, serverId, properties)
  • product: the lot for purchase
  • serverId: the server ID where the reward will be credited. For games without a server, you still need to specify a placeholder ID. Check with the project producer.
  • properties: a list of additional parameters that will be sent when sending purchase data to our API. Optional parameter.

Some Clarifications on How Non-Consumable Purchases Work on Android

In the Android Google Console, there is no concept of non-consumable purchases. That is, all purchases are consumable. But all purchases have 2 stages: Purchasing the lot Consuming the lot

That is, if you called Platform101XP.purchaseProduct(product, serverId, properties) and the user bought the lot, it will always be in the user's data, and when calling Platform101XP.restoreProducts(), it will return the made purchase and also won't allow buying the lot again. Until the moment when you forcibly call Platform101XP.finishPurchase(purchase), then the lot will be consumed, and the Google billing server will no longer return this purchase when calling Platform101XP.restoreProducts(). Therefore, the action flow:

  • For Non-Consumable purchases: just call Platform101XP.purchaseProduct and that's it. And also restore when needed.
  • For Consumable purchases: when the information comes from the SDK that the lot is purchased in the main listener override fun onPurchaseProductResult(purchase: Platform101XPPurchase?, error: Platform101XPError?), credit the 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.