如何使用应用程序链接将参数传递给android playstore以在应用程序安装时进行检索 [英] how to use app links to pass parameter to android playstore to be retrieved when app is installed

查看:242
本文介绍了如何使用应用程序链接将参数传递给android playstore以在应用程序安装时进行检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款社交机器人琐事游戏。
当用户挑战游戏时,一位没有安装我的琐事游戏的朋友,我想向他发送一个自定义网址,以便从市场中下载包含邀请用户ID参数的应用程序。

当应用程序第一次运行时,我需要能够接收传递给市场的参数,以便识别用户并向他展示游戏他受到了挑战。
我无法弄清楚如何通过应用程序链接来做到这一点,并没有找到任何合适的例子。



任何帮助将非常受欢迎!
Thanks,
Ido

解决方案

要将数据发送到Android Market,您必须构建一个uri像这样:

  market:// details?id = my.package.name& referrer = someDataToTransfer 

要获取此数据,您应该实现 INSTALL_REFERRER Receiver。

 < receiver android:name =my.package.MyReceiver
android:exported =true> ;
< intent-filter>
< / intent-filter>
< / receiver>

这里是一个简短的教程,它将解释你如何完全实现这个解决方案。



如果您想在不写任何代码的情况下进行测试,请在安装Referrer 。 com / SimonMarquis / Android-InstallReferrer> GitHub Play商店


I'm developing a social android trivia game. When a user challenges to a game a friend, who doesn't have my trivia game installed, i'd like to send him a custom url to download the app from the market containing a parameter of the inviting user id.

when the app is run for the first time, i need to be able to receive the parameter passed to the market, in order to identify the user and show him the game he was challenged to. i couldn't figure out how to do this with app links and didn't find any appropriate example.

any help would be greatly welcomed! Thanks, Ido

解决方案

To send data to the Android Market, you have to build an uri like this one:

market://details?id=my.package.name&referrer=someDataToTransfer

To get this data back, you should implement an INSTALL_REFERRER Receiver.

<receiver android:name="my.package.MyReceiver"
          android:exported="true">
   <intent-filter>
   <action android:name="com.android.vending.INSTALL_REFERRER"></action>
   </intent-filter>
</receiver>

Here is a short tutorial that will explain you how to fully implement this solution.

And if you want to test it without writting any code, checkout my app: Install Referrer on GitHub or on the Play Store

这篇关于如何使用应用程序链接将参数传递给android playstore以在应用程序安装时进行检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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