Google Play 內嵌安裝 (應用程式)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁面說明應用程式開發人員如何整合內嵌安裝功能,這是 Google Play 的新測試功能,可在半頁面介面中顯示 Google Play 應用程式產品詳細資料。內嵌安裝功能可讓使用者不必離開應用程式情境,就能體驗流暢的應用程式安裝流程。應用程式開發人員可以為透過 Play 發行或更新的應用程式,整合及測試內嵌安裝功能。
需求條件
如要在應用程式中顯示半頁面介面:
- 最低 Google Play 版本必須為 40.4。
- Android API 級別必須為 23 以上。
從應用程式叫用內嵌安裝
如要從應用程式叫用內嵌安裝半頁,請建立 Intent
類別的例項,以便開啟深層連結網址。請參考下列範例程式碼 (Kotlin 或 Java)。
Kotlin
val intent = Intent(Intent.ACTION_VIEW)
val referrer = "<Your referrer string>"
val id = "<Package name of the app that is to be installed>"
val callerId = "<Package name of your app>"
intent.setPackage("com.android.vending")
val deepLinkUrl = "https://play.google.com/d?id=$id&referrer=$referrer&listing=$csl_id"
intent.data = Uri.parse(deepLinkUrl)
intent.putExtra("overlay", true)
intent.putExtra("callerId", "$callerId")
val packageManager = context.getPackageManager()
if (intent.resolveActivity(packageManager) != null) {
startActivityForResult(intent, 0)
} else {
// Fallback to deep linking to full Play Store.
}
Java
Intent intent = new Intent(Intent.ACTION_VIEW);
String referrer = "<Your referrer string>";
String id = "<Package name of the app that is to be installed>";
String callerId = "<package name of your app>";
String csl_id = "<Custom store listing id>";
intent.setPackage("com.android.vending");
String deepLinkUrl = "https://play.google.com/d?id=" + id + "&referrer=" + referrer + "&listing=" + csl_id;
intent.setData(Uri.parse(deepLinkUrl));
intent.putExtra("overlay", true);
intent.putExtra("callerId", callerId);
PackageManager packageManager = context.getPackageManager();
if (intent.resolveActivity(packageManager) != null) {
startActivityForResult(intent, 0);
} else {
// Fallback to deep linking to full Play Store.
}
內嵌安裝 API 參數
欄位 |
說明 |
必填 |
referrer |
選用的參照網址追蹤字串 |
否 |
id |
要安裝的應用程式
套件名稱 |
是 |
overlay |
如果要求內嵌半頁,請設為 true ;如果是 false ,意圖會連結至 Google Play |
是 |
callerId |
呼叫端應用程式的
套件名稱 |
是 |
listing |
指定自訂商店資訊目標的選用參數 |
否 |
如果應用程式安裝流程未顯示 Google Play 內嵌安裝半頁面介面,系統會改為顯示 Google Play 資訊清單的直接連結 (深層連結)。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Google Play Inline Installs (Apps)\n\nThis page describes how app developers can integrate *inline install*, a new\ntest feature for Google Play that presents Google Play app product details in a\nhalf sheet interface. Inline install enables users to experience a seamless app\ninstall flow without leaving the context of the app. App developers can\nintegrate and test the inline install feature for Play distributed or updated\napps.\n\nRequirements\n------------\n\nFor the half sheet interface to appear in an app:\n\n- The minimum Google Play version must be **40.4**.\n- The Android API level must be **23 or higher**.\n\nInvoke inline installs from an app\n----------------------------------\n\nTo invoke inline install half sheet from an app, create an instance of the\n[`Intent`](/reference/android/content/Intent) class, which opens a deep link\nURL. Use the following sample code (Kotlin or Java) as a guideline. \n\n### Kotlin\n\n```kotlin\nval intent = Intent(Intent.ACTION_VIEW)\nval referrer = \"\u003cYour referrer string\u003e\"\nval id = \"\u003cPackage name of the app that is to be installed\u003e\"\nval callerId = \"\u003cPackage name of your app\u003e\"\nintent.setPackage(\"com.android.vending\")\nval deepLinkUrl = \"https://play.google.com/d?id=$id&referrer=$referrer&listing=$csl_id\"\nintent.data = Uri.parse(deepLinkUrl)\nintent.putExtra(\"overlay\", true)\nintent.putExtra(\"callerId\", \"$callerId\")\nval packageManager = context.getPackageManager()\nif (intent.resolveActivity(packageManager) != null) {\n startActivityForResult(intent, 0)\n} else {\n // Fallback to deep linking to full Play Store.\n}\n```\n\n### Java\n\n```java\nIntent intent = new Intent(Intent.ACTION_VIEW);\nString referrer = \"\u003cYour referrer string\u003e\";\nString id = \"\u003cPackage name of the app that is to be installed\u003e\";\nString callerId = \"\u003cpackage name of your app\u003e\";\nString csl_id = \"\u003cCustom store listing id\u003e\";\nintent.setPackage(\"com.android.vending\");\nString deepLinkUrl = \"https://play.google.com/d?id=\" + id + \"&referrer=\" + referrer + \"&listing=\" + csl_id;\nintent.setData(Uri.parse(deepLinkUrl));\nintent.putExtra(\"overlay\", true);\nintent.putExtra(\"callerId\", callerId);\nPackageManager packageManager = context.getPackageManager();\nif (intent.resolveActivity(packageManager) != null) {\n startActivityForResult(intent, 0);\n} else {\n // Fallback to deep linking to full Play Store.\n}\n```\n\nInline install API parameters\n-----------------------------\n\n| Field | Description | Required |\n|------------|---------------------------------------------------------------------------------------------------|----------|\n| `referrer` | An optional [referrer](/google/play/installreferrer) tracking string | No |\n| `id` | The [package name](https://support.google.com/admob/answer/9972781) of the app to be installed | Yes |\n| `overlay` | Set to `true` if inline half sheet is requested; if `false`, the intent deep links to Google Play | Yes |\n| `callerId` | The [package name](https://support.google.com/admob/answer/9972781) of the caller app | Yes |\n| `listing` | An optional parameter to specify the target for a custom store listing | No |\n\nIf the app install flow doesn't display the Google Play inline install half\nsheet interface, a direct (deep link) to the Google Play listing is shown\ninstead."]]