Android showInAppMessagesAndroid

Shows Google Play billing in-app messages, such as transactional subscription updates. OpenIAP support starts in Spec 2.1.0 and openiap-google 2.3.0. The upstream API is available in Play Billing 4.1.0+; Play Billing 9.0+ also uses transactional messages for pending subscription price-increase opt-ins.

Wraps BillingClient.showInAppMessages(...). If the result is 'subscription-status-updated', use the returned purchaseToken to refresh the affected subscription state. Google recommends checking transactional messages whenever the app opens. This API implements the React Native request tracked in issue #221.

Signature

kt
suspend fun showInAppMessages(
    activity: Activity,
    params: InAppMessageParamsAndroid? = null
): InAppMessageResultAndroid

Parameters#

Optional InAppMessageParamsAndroid:

Returns#

Promise<InAppMessageResultAndroid> with:

  • responseCode (InAppMessageResponseCodeAndroid) - result of the in-app message flow.
  • purchaseToken (string | null) - present when a subscription status changed.

Example

kt
val result = openIapStore.showInAppMessages(
    activity,
    InAppMessageParamsAndroid(
        categories = listOf(InAppMessageCategoryAndroid.Transactional)
    )
)