Google play store is changing the referrer data to “com.android.chrome”?

拥有回忆 提交于 2019-12-10 15:18:12

问题


I am new to referrer concept.

I have written a code, the intention of which is to have google playstore send a referrer data as a broadcast to my app after installation which I catch and handle accordingly. The problem is the data that I am asking google to fireback is different from what google is actually sending to me.

I use the following code to create the link:

final String url = "intent://details?id=com.myapp&url="a dummy url"&referrer="+referrer+"#Intent;scheme=market;action=android.intent.action.VIEW;package=com.myapp;S.referrer="+referrer+";end";

Here referrer = < a correct base64 encoded string >

NOTE:
The initial dummy URL is not of any use to me. My interest is to fallback to google to install the app. The assumption here is that I don't have the app installed on device, hence this should work. The fallback is happening correctly and I am directed to Google PlayStore from where I install the app then the referrer data is broadcast to my app. I catch the referrer data and show it in a toast in the production build.

What I expect to see in the toast data: < my base64 encoded which i sent >
What I see: "com.android.chrome"

Why is this happening?


回答1:


After spending too much of time . I was able to figure out what was happening. If there are no referrers given chrome attaches its own referrer whose value is "com.android.chrome". The way I was attaching the referrer was wrong , hence chrome's default referrer was picked up. The correction is in the last part

change this

...;package=com.myapp;S.referrer="+referrer+";end";

to

...;package=com.myapp&referrer="+referrer+";end";

Hope this helps others. My whole day was spent in this.



来源:https://stackoverflow.com/questions/39746583/google-play-store-is-changing-the-referrer-data-to-com-android-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!