从 Google Play 安装时将参数传递给应用程序 [英] Pass param to app when installed from Google Play

查看:35
本文介绍了从 Google Play 安装时将参数传递给应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要支持以下场景:

用户收到包含我的应用程序链接的电子邮件.

User receives the e-mail with link to my app.

如果用户已经安装了应用,则链接应该打开应用,将 Intent 中的一些数据传递给启动器 Activity.

If user already has the app installed the link should open the app passing some data in the intent to the launcher activity.

如果应用尚未安装,则电子邮件链接应充当广告系列推荐人:将用户引导至 Google Play 以使用推荐人 URL 安装该应用,该 URL 是在推荐人广播接收器中安装后传递给我的应用程序.

If the app is not installed yet the e-mail link should act as campaign referrer: direct user to Google Play to install the app with referrer url that is passed to my app after installation in referrer broadcast receiver.

推荐答案

需要拦截com.android.vending.INSTALL_REFERRER Intent,该Intent在应用打开后由Google Play广播安装后的第一次,并在该 Intent 中捕获数据.用于启动 Google Play 的 URI 中的参数将在 referrer String extra 中传递.(尽管您仅限于允许的参数列表,请参阅该表的官方文档.)

You need to intercept the com.android.vending.INSTALL_REFERRER Intent, which is broadcast by Google Play after the app is opened for the first time after installation, and catch the data in that Intent. The parameters in the URI used to launch Google Play will be passed along in the referrer String extra. (Though you are limited to a list of allowed params, see the official docs for that table.)

https://developers.google.com/analytics/devguides/collection/android/v4/campaigns

Google 在发送给开发者的电子邮件中宣布,从 2020 年 3 月 1 日起,他们将不再支持此功能.开发者需要使用新的API https://developer.android.com/google/play/installreferrer/library.html.

Google has announced in an email sent to developers that as of March 1, 2020, they will no longer be supporting this. Developers need to use the new API https://developer.android.com/google/play/installreferrer/library.html.

这篇关于从 Google Play 安装时将参数传递给应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆