การติดตั้งในบรรทัด Google Play (แอป)
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้จะอธิบายวิธีที่นักพัฒนาแอปผสานรวมการติดตั้งจากในหน้าเว็บ ซึ่งเป็นฟีเจอร์ทดสอบใหม่สำหรับ Google Play ที่แสดงรายละเอียดผลิตภัณฑ์แอป Google Play ในอินเทอร์เฟซแบบครึ่งหน้า การติดตั้งในบรรทัดช่วยให้ผู้ใช้ได้รับประสบการณ์การติดตั้งแอปที่ราบรื่นโดยไม่ต้องออกจากบริบทของแอป นักพัฒนาแอปสามารถผสานรวมและทดสอบฟีเจอร์การติดตั้งในบรรทัดสำหรับแอปที่เผยแพร่หรืออัปเดตใน Play
ข้อกำหนด
วิธีทำให้อินเทอร์เฟซแบบครึ่งหน้าจอปรากฏในแอป
- เวอร์ชัน Google Play ขั้นต่ำต้องเป็น 40.4
- ระดับ API ของ Android ต้องเท่ากับ 23 ขึ้นไป
เรียกใช้การติดตั้งในหน้าเว็บจากแอป
หากต้องการเรียกใช้ครึ่งหน้าการติดตั้งในบรรทัดจากแอป ให้สร้างอินสแตนซ์ของคลาส Intent
ซึ่งจะเปิด URL ของ Deep Link ใช้โค้ดตัวอย่างต่อไปนี้ (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 |
สตริงการติดตาม referrer ที่ไม่บังคับ |
ไม่ |
id |
ชื่อแพ็กเกจของแอปที่จะติดตั้ง |
ใช่ |
overlay |
ตั้งค่าเป็น true หากมีการขอครึ่งหน้าในบรรทัด หากเป็น false แสดงว่า Intent จะลิงก์ไปยัง Google Play |
ใช่ |
callerId |
ชื่อแพ็กเกจของแอปที่โทรเข้ามา |
ใช่ |
listing |
พารามิเตอร์ที่ไม่บังคับเพื่อระบุเป้าหมายสำหรับข้อมูลผลิตภัณฑ์ใน Store ที่กําหนดเอง |
ไม่ |
หากขั้นตอนการติดตั้งแอปไม่แสดงอินเทอร์เฟซชีตครึ่งหน้าสำหรับการติดตั้งในบรรทัดของ Google Play ระบบจะแสดง Deep Link ไปยังข้อมูลผลิตภัณฑ์ใน Google Play โดยตรงแทน
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],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."]]