Play Install Referrer API
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.
Tài liệu này đưa ra tài liệu tham khảo kỹ thuật để sử dụng Play Install Referrer API. API Play Install Referrer là một giao diện dịch vụ AIDL chủ yếu được lập trình viên không dùng ngôn ngữ lập trình Java sử dụng.
Lưu ý:
Thư viện Play Install Referrer
cung cấp một lớp trình bao bọc quanh API Play Install Referrer và được thiết kế để giúp lập trình viên Java
sử dụng API này.
Phương thức getInstallReferrer()
Phương thức này trả về thông tin tham chiếu về việc cài đặt ứng dụng, tương ứng với
tên gói nhất định được gửi qua một Bundle
(khoá liên kết được nêu trong bảng 1). Trong
phản hồi Bundle
do Google Play gửi, thông tin tham chiếu lưu trữ trong
các trường liên kết tới các khoá được nêu chi tiết trong bảng 2.
Bảng 1. Yêu cầu dữ liệu gói getInstallReferrer()
.
Thông số
|
Loại
|
Nội dung mô tả
|
package_name
|
String
|
Tên gói của phương thức gọi, được dùng để phân định.
|
Bảng 2. Dữ liệu phản hồi từ yêu cầu getInstallReferrer()
.
Khóa
|
Loại
|
Nội dung mô tả
|
install_referrer
|
String
|
URL liên kết giới thiệu của gói được cài đặt.
|
referrer_click_timestamp_seconds
|
long
|
Dấu thời gian phía máy khách, tính bằng giây, khi có lượt nhấp vào liên kết giới thiệu.
|
install_begin_timestamp_seconds
|
long
|
Dấu thời gian phía máy khách, tính bằng giây, khi quá trình cài đặt ứng dụng bắt đầu.
|
referrer_click_timestamp_server_seconds
|
long
|
Dấu thời gian phía máy chủ, tính bằng giây, khi có lượt nhấp vào liên kết giới thiệu.
|
install_begin_timestamp_server_seconds
|
long
|
Dấu thời gian phía máy chủ, tính bằng giây, khi quá trình cài đặt ứng dụng bắt đầu.
|
install_version
|
string
|
Phiên bản của ứng dụng tại thời điểm cài đặt lần đầu.
|
google_play_instant
|
boolean
|
Cho biết liệu trải nghiệm tức thì của ứng dụng có được phát hành trong
7 ngày qua hay không.
|
Chú ý: Thông tin tham chiếu cài đặt sẽ có sẵn trong vòng 90 ngày và không thay đổi trừ khi ứng dụng này được cài đặt lại. Để tránh các lệnh gọi API không cần thiết trong ứng dụng, bạn nên gọi
API một lần duy nhất trong lần thực thi đầu tiên sau khi cài đặt.
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.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Play Install Referrer API\n\nThis documentation provides technical reference for using the\nPlay Install Referrer API. The Play Install Referrer API is an\n[AIDL Service Interface](https://developer.android.com/guide/components/aidl.html)\nprimarily used by non-Java programmers.\n\n\n**Note:** The\n[Play Install Referrer Library](/google/play/installreferrer/library)\nprovides a wrapper around the Play Install Referrer API and is designed to help Java\nprogrammers use the API.\n\nThe getInstallReferrer() method\n-------------------------------\n\nThis method returns the app install referrer information corresponding to the\ngiven package name sent through a `Bundle` (key mapped in table 1). In the\nresponse `Bundle` sent by Google Play, the referral information is stored in\nfields mapped to the keys detailed in table 2.\n\n\n**Table 1.** `getInstallReferrer()` bundle data\nrequest.\n\n| Parameter | Type | Description |\n|----------------|----------|----------------------------------------------------------|\n| `package_name` | `String` | The package name of the caller, used for disambiguation. |\n\n\n**Table 2.** Response data from a `getInstallReferrer()`\nrequest.\n\n| Key | Type | Description |\n|-------------------------------------------|-----------|--------------------------------------------------------------------------------------|\n| `install_referrer` | `String` | The referrer URL of the installed package. |\n| `referrer_click_timestamp_seconds` | `long` | The client-side timestamp, in seconds, when the referrer click happened. |\n| `install_begin_timestamp_seconds` | `long` | The client-side timestamp, in seconds, when app installation began. |\n| `referrer_click_timestamp_server_seconds` | `long` | The server-side timestamp, in seconds, when the referrer click happened. |\n| `install_begin_timestamp_server_seconds` | `long` | The server-side timestamp, in seconds, when app installation began. |\n| `install_version` | `string` | The app's version at the time when the app was first installed. |\n| `google_play_instant` | `boolean` | Indicates whether your app's instant experience was launched within the past 7 days. |\n\n**Caution:** The install referrer information will be\navailable for 90 days and **won't change** unless the application is\nreinstalled. To avoid unnecessary API calls in your app, you should invoke the\nAPI **only once** during the first execution after install."]]