跳转到正文

Android Referrer

GitHub

在 Android 端, getReferrer() 该插件连接到 Google Play Install Referrer 服务,并返回来自 Play Store 安装记录的数据。

const result = await InstallReferrer.getReferrer();
console.log(result.referrer);
console.log(result.clickTimestampSeconds);
console.log(result.installBeginTimestampSeconds);
console.log(result.googlePlayInstantParam);
字段描述
platform始终 android.
referrerPlay 安装来源的原始字符串。
clickTimestampSeconds客户端来源点击的时间戳(秒)。
installBeginTimestampSeconds客户端安装开始的时间戳(秒)。
googlePlayInstantParam用户是否启动了应用的即时体验。
  • 必须通过 Google Play 安装应用才能获取真实的安装来源数据。
  • 设备上的 Play Store 版本必须支持 Install Referrer 服务。
  • 无需 Android 运行时权限。

当 Play Store 服务不可用、不受支持、在返回结果前断开连接,或返回意外响应时,该插件会 reject。

如果你正在使用 Android Referrer 要规划原生插件工作,请将其与 使用 @capgo/capacitor-install-referrer 以使用 @capgo/capacitor-install-referrer 中的原生能力, Capgo 插件目录 查看 Capgo 插件目录中的产品工作流, Capgo 提供的 Capacitor 插件 查看由 Capgo 提供的 Capacitor 插件中的实现细节, 添加或更新插件 关于“添加或更新插件”中的实现细节,以及 Ionic Enterprise 插件替代方案 关于“Ionic Enterprise 插件替代方案”中的产品工作流。