Android launchExternalLinkAndroid

Step 2 of Billing Programs API. Launch external link flow — shows Play Store dialog and optionally launches external URL.

Wraps BillingClient.launchExternalLink(activity, params, listener) — replaces showExternalOfferInformationDialog. Shows the Play disclosure dialog and (optionally) launches the URL. Play Billing 8.2.0+. Billing Choice external-link flows require 9.1.0+. See the Google Play Billing reference.

Signature

kt
// Returns true if launched successfully
// Throws OpenIapError.NotPrepared if billing client not ready
suspend fun launchExternalLink(
    activity: Activity,
    params: LaunchExternalLinkParamsAndroid
): Boolean

// LaunchExternalLinkParamsAndroid:
// - billingProgram: BillingProgramAndroid
// - externalTransactionToken: String? (Billing Choice external-link flow)
// - launchMode: ExternalLinkLaunchModeAndroid
// - linkType: ExternalLinkTypeAndroid
// - linkUri: String

Parameters#

Pass a single LaunchExternalLinkParamsAndroid:

  • billingProgram (required, BillingProgramAndroid) — Billing program the link belongs to (EXTERNAL_CONTENT_LINK, EXTERNAL_OFFER, or BILLING_CHOICE).
  • externalTransactionToken (optional, string) — Pre-generated reporting token for a developer-rendered Billing Choice external-link flow (scenario 2B). Generate it with createBillingProgramReportingDetailsAndroid using EXTERNAL_LINK, then pass the same token here.
  • launchMode (required, ExternalLinkLaunchModeAndroid) — How the link is presented (in-app browser, system browser, etc.).
  • linkType (required, ExternalLinkTypeAndroid) — Type of the external link (e.g. offer page).
  • linkUri (required, string) — External URI to launch after the Play disclosure dialog dismisses.

Returns#

Promise<boolean>true when Play accepts the launch request and its disclosure/link flow completes successfully.

Example

kt
openIapStore.launchExternalLink(
    activity,
    LaunchExternalLinkParamsAndroid(
        billingProgram = BillingProgramAndroid.BillingChoice,
        externalTransactionToken = reportingDetails.externalTransactionToken,
        launchMode = ExternalLinkLaunchModeAndroid.LaunchInExternalBrowserOrApp,
        linkType = ExternalLinkTypeAndroid.LinkToDigitalContentOffer,
        linkUri = "https://example.com/offer"
    )
)