Cài đặt cùng dòng trên Google Play (Ứng dụng)
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này mô tả cách nhà phát triển ứng dụng có thể tích hợp tính năng cài đặt cùng dòng, một tính năng thử nghiệm mới cho Google Play. Tính năng này trình bày thông tin chi tiết về sản phẩm ứng dụng trên Google Play trong giao diện nửa trang. Tính năng cài đặt cùng dòng cho phép người dùng trải nghiệm quy trình cài đặt ứng dụng liền mạch mà không cần rời khỏi ngữ cảnh của ứng dụng. Nhà phát triển ứng dụng có thể tích hợp và kiểm thử tính năng cài đặt cùng dòng cho các ứng dụng được phân phối hoặc cập nhật trên Play.
Yêu cầu
Để giao diện nửa trang xuất hiện trong ứng dụng:
- Phiên bản Google Play tối thiểu phải là 40.4.
- Cấp độ API Android phải là 23 trở lên.
Gọi lượt cài đặt nội tuyến từ một ứng dụng
Để gọi một nửa trang cài đặt cùng dòng từ một ứng dụng, hãy tạo một thực thể của lớp Intent
. Lớp này sẽ mở một URL liên kết sâu. Hãy sử dụng mã mẫu sau (Kotlin hoặc Java) làm nguyên tắc.
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.
}
Tham số API cài đặt nội tuyến
Trường |
Nội dung mô tả |
Bắt buộc |
referrer |
Chuỗi theo dõi người giới thiệu không bắt buộc |
Không |
id |
Tên gói của ứng dụng cần cài đặt |
Có |
overlay |
Đặt thành true nếu yêu cầu một nửa trang nội tuyến; nếu là false , ý định sẽ liên kết sâu đến Google Play |
Có |
callerId |
Tên gói của ứng dụng gọi |
Có |
listing |
Một thông số không bắt buộc để chỉ định mục tiêu cho trang thông tin tuỳ chỉnh trên Cửa hàng Play |
Không |
Nếu quy trình cài đặt ứng dụng không hiển thị giao diện trang tính một nửa cài đặt nội tuyến của Google Play, thì một đường liên kết trực tiếp (đường liên kết sâu) đến trang thông tin trên Google Play sẽ xuất hiện.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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."]]