简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM