Play Install Referrer API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本文档提供了有关使用 Play Install Referrer API 的技术参考信息。Play Install Referrer API 是一种 AIDL 服务接口,主要供非 Java 程序员使用。
注意:Play Install Referrer 库提供 Play Install Referrer API 的封装容器,旨在帮助 Java 程序员使用该 API。
getInstallReferrer() 方法
此方法返回与通过 Bundle
发送的给定软件包名称(表 1 中映射的键)相对应的应用安装引荐来源信息。在 Google Play 发送的 Bundle
响应中,引荐来源信息存储在映射到表 2 中详述的键的字段中。
表 1. getInstallReferrer()
bundle 数据请求。
参数
|
类型
|
说明
|
package_name
|
String
|
调用方的软件包名称,用于消除歧义。 |
表 2. 来自 getInstallReferrer()
请求的响应数据。
键
|
类型
|
说明
|
install_referrer
|
String
|
已安装软件包的引荐来源网址。
|
referrer_click_timestamp_seconds
|
long
|
引荐来源网址点击事件发生时的客户端时间戳(以秒为单位)。
|
install_begin_timestamp_seconds
|
long
|
应用安装开始时的客户端时间戳(以秒为单位)。
|
referrer_click_timestamp_server_seconds
|
long
|
引荐来源网址点击事件发生时的服务器端时间戳(以秒为单位)。
|
install_begin_timestamp_server_seconds
|
long
|
应用安装开始时的服务器端时间戳(以秒为单位)。
|
install_version
|
string
|
首次安装应用时的应用版本。
|
google_play_instant
|
boolean
|
表明应用的免安装应用是在过去 7 天内发布的。
|
注意:安装引荐来源信息的有效期为 90 天,并且在用户重新安装应用之前不会发生变化。为避免应用中进行不必要的 API 调用,您应该在安装完成后首次执行期间仅调用 API 一次。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],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."]]