このページでは、カタログ アクセス プログラムに登録しているサードパーティのアプリストアが、Google Play のインライン インストールを統合する方法について説明します。インライン インストールは、米国のサードパーティの Android アプリストアが、Google Play ストアから直接行われる他のダウンロードと同じ条件で、Google Play を通じて Google Play のアプリのダウンロードにユーザーを誘導できるようにする機能です。
前提条件
サードパーティのアプリストアにインライン インストール API を統合する前に、Google Play Console で次の設定を完了する必要があります。
- Google Play カタログ アクセス プログラムに登録する: 登録手順に沿って登録します。
- カタログ アクセスにオプトインする: Google Play Console の設定でカタログ アクセス プログラムに登録します。
- 配信トークンを取得する: 提供された Google Play アプリカタログのエクスポートを処理します。このエクスポートには、配布対象の各アプリに必要な
catalog_token(デリバリー トークン)が含まれています。
要件
ハーフシート インターフェースがユーザーに正常に表示されるには、次の要件を満たす必要があります。
- お客様は米国に居住している必要があります。
- デバイスの Google Play の最小バージョンは 52.3 である必要があります。
- Android API レベルは 24 以上である必要があります。
- Google Play ストアにアクセスするには、有効期限内の有効な
catalog_tokenを指定する必要があります。
アプリストアからインライン インストールを呼び出す
インライン インストールのハーフシートを呼び出すには、Google Play のディープリンク URL をターゲットとし、一意の catalog_token を含む Intent クラスのインスタンスを作成します。
次のサンプルコード(Kotlin または Java)をガイドラインとして使用します。
Kotlin
val intent = Intent(Intent.ACTION_VIEW) val referrer = "<Your referrer string>" val id = "<Package name of the app to be installed>" val callerId = "<Package name of your third-party app store>" // Retrieve the app-specific token from your processed catalog export val catalogToken = getVerificationTokenByDocId(id) intent.setPackage("com.android.vending") val deepLinkUrl = "https://play.google.com/d?id=$id&referrer=$referrer" intent.data = Uri.parse(deepLinkUrl) // Set the required intent extras intent.putExtra("overlay", true) intent.putExtra("callerId", callerId) intent.putExtra("catalog_token", catalogToken) val packageManager = context.getPackageManager() if (intent.resolveActivity(packageManager) != null) { startActivityForResult(intent, 0) // Call with a request code to receive ActivityResults }
Java
Intent intent = new Intent(Intent.ACTION_VIEW); String referrer = "<Your referrer string>"; String id = "<Package name of the app to be installed>"; String callerId = "<Package name of your third-party app store>"; // Retrieve the app-specific token from your processed catalog export String catalogToken = getVerificationTokenByDocId(id); intent.setPackage("com.android.vending"); String deepLinkUrl = "https://play.google.com/d?id=" + id + "&referrer=" + referrer; intent.setData(Uri.parse(deepLinkUrl)); // Set the required intent extras intent.putExtra("overlay", true); intent.putExtra("callerId", callerId); intent.putExtra("catalog_token", catalogToken); PackageManager packageManager = context.getPackageManager(); if (intent.resolveActivity(packageManager) != null) { startActivityForResult(intent, 0); // Call with a request code to receive ActivityResults }
Inline Install API のパラメータ
インライン インストールを承認するには、次のパラメータをインテント URL またはインテント エクストラとして渡す必要があります。
| フィールド | タイプ | ロケーション | 説明 | 必須 |
|---|---|---|---|---|
id |
String |
URL クエリ | インストールするターゲット アプリのパッケージ名。 | はい |
referrer |
String |
URL クエリ | オプションのリファラー トラッキング文字列。 | いいえ |
overlay |
boolean |
インテント エクストラ | インライン ハーフシート インターフェースをリクエストするには、true に設定します。 |
はい |
callerId |
String |
インテント エクストラ | 承認済みのサードパーティのアプリストアのパッケージ名。 | はい |
catalog_token |
String |
インテント エクストラ | カタログ アクセスのエクスポートで提供される一意の配信トークン。注: トークンは、鮮度、ターゲット パッケージの一致、呼び出し元パッケージの一致について検証されます。 | はい |
(省略可)インストール ステータス オーバーレイ付きの Google Play インライン インストール
インライン インストール フローでインストール ステータスのオーバーレイを表示するには、Google Play HSDP SDK を使用して、Google Play インライン インストールを永続的アフォーダンス機能と統合する必要があります。
永続的なアフォーダンスを含むインライン インストール フローが表示されるようにするには、次の条件を満たす必要があります。
- 対象デバイスの Google Play ストアのバージョンが 52.6 以降である必要があります。
- Android API レベルは 24(Android M)以降である必要があります。
- バージョン 2.1.0 以降の HSDP SDK と統合します。
インテグレーションの例
Kotlin
// Step 1: Initialize HSDP Service // Note: Calling create(activity) automatically configures useServiceBasedHsdp = false // (Activity Path) under the hood without requiring manual boolean flags. val hsdpService = HsdpDeepLinkServiceFactory.create(activity) // Step 2: Construct Extra Query Parameters with Catalog Token val extraQueryParams = mapOf("catalog_token" to "YOUR_SECURE_CATALOG_TOKEN_VALUE") // Step 3: Trigger Inline Install Flow hsdpService.open( targetAppPackageName = "com.example.targetapp", referrer = "3pas_ad_campaign_123", listener = object : HsdpDeepLinkServiceListener { override fun onDeepLinkStarted() { // Inline details dialog started successfully } override fun onAffordanceStarted() { // HPOA persistent affordance UI attached } override fun onAffordanceEnded() { // Affordance UI detached } override fun onError(errorMessage: String) { // Handle error or fallback } }, extraQueryParams = extraQueryParams )
Java
// Step 1: Initialize HSDP Service // Note: Calling create(activity) automatically configures useServiceBasedHsdp = false // (Activity Path) under the hood without requiring manual boolean flags. HsdpDeepLinkService hsdpService = HsdpDeepLinkServiceFactory.create(activity); // Step 2: Construct Extra Query Parameters with Catalog Token Map<String, String> extraQueryParams = new HashMap<>(); extraQueryParams.put("catalog_token", "YOUR_SECURE_CATALOG_TOKEN_VALUE"); // Step 3: Trigger Inline Install Flow hsdpService.open( "com.example.targetapp", "3pas_ad_campaign_123", new HsdpDeepLinkServiceListener() { @Override public void onDeepLinkStarted() { // Inline details dialog started successfully } @Override public void onAffordanceStarted() { // HPOA persistent affordance UI attached } @Override public void onAffordanceEnded() { // Affordance UI detached } @Override public void onError(String errorMessage) { // Handle error or fallback } }, extraQueryParams);
アフォーダンス トラッキングの停止の例
呼び出し元アプリがインストール状態のトラッキングを手動で停止し、HPOA オーバーレイを閉じることができるようにします。注: これにより、HSDP インストール シート自体は閉じられず、アフォーダンスのみが閉じられます。
Kotlin
// Stop tracking the installation state and dismiss the affordance overlay hsdpService.stopAffordance( targetAppPackageName = "com.example.targetapp", listener = object : HsdpDeepLinkService.AffordanceListener { override fun onAffordanceStopped() { // Affordance overlay stopped successfully } } )
Java
// Stop tracking the installation state and dismiss the affordance overlay hsdpService.stopAffordance( "com.example.targetapp", new HsdpDeepLinkService.AffordanceListener() { @Override public void onAffordanceStopped() { // Affordance overlay stopped successfully } });
アフォーダンスの状態と UX
永続的なアフォーダンス機能を備えた Google Play インライン インストールには、2 つの視覚的な状態があります。
- インストール中の状態: 対象アプリのサムネイルと、インストールの進行状況を示すスピナーが表示されます。サムネイルをクリックすると、HSDP インストール シートが再起動します。
- インストール後の状態: 対象アプリアイコンと [開く] アクションが表示されます。サムネイルをクリックすると、新しくインストールされたアプリが開きます。
| インストール中 | インストール後 |
|---|---|
![]() ![]() |
![]() |


