Pass referrer data through chrome intent to google play

冷暖自知 提交于 2019-12-20 09:49:48

问题


So I have a mobile web that would try to open my android app, if it does not exist, it would fall back to google play.

for chrome, i use this intent:

intent://some_data_sent_to_app#Intent;scheme=app_scheme;package=package_name;end

and it works fine, now I want to send some referrer string to google play for the INSTALL_REFERRER in an app.

I tried the following link, it has no problem of sending data to google play, but it would not try to open the app

intent://some_data_sent_to_app#Intent;scheme=app_scheme;package=package_name&referrer=referrer_string;end

I wonder what is the correct way to open the app and fall back to google play with the referrer data being passed?


回答1:


Looks like it can be done by passing S.market_referrer=referrer_string

For example

intent://some_data_sent_to_app#Intent;scheme=app_scheme;package=package_name;S.market_referrer=referrer_string;end

I have not tested this, but there are some check-ins in the chromium repo for this, don't know if it is available in the current version of chrome.

https://codereview.chromium.org/2061493002




回答2:


This is a known issue that I am working with the team to get fixed. Someone in the past suggested that you can use intent://some_data_sent_to_app#Intent;scheme=app_scheme;package=package_name&referrer=referrer_string;end however the logic of this has never worked specifically because the Chrome browser (and Android Browser) look for a package id that is direct copy of the string which is parsed as package_name&referrer=referrer_string.




回答3:


With the new scheme, you can pass arguments as extras to the App, but you must encode the URI as follow:

<a href="intent://whatever/#Intent;scheme=myapp;package=com.what.ever.myapp;S.myextra=mystring;end">Do Whatever</a>

source



来源:https://stackoverflow.com/questions/24833801/pass-referrer-data-through-chrome-intent-to-google-play

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