Opening app in Google Play from a redirect link

空扰寡人 提交于 2019-12-31 09:15:44

问题


On an Android device, opening a link to an app on Google Play:

https://play.google.com/store/apps/details?id=com.rovio.angrybirds&hl=en

will automatically open the Google Play app by default.

But if you have a link that redirects to the Google Play link, the device opens the browser and then navigates to the browser version of Google Play. Why does this behavior occur?

Unfortunately I cannot use the market:// with Intents which can open Play, I have only control over a web link.

edit: Seems like if I have the link redirect to the market:// url, it can open with Google Play on device.

If link is opened in browser, somehow it is able to redirect to browser version of Google Play despite market:// not being supported in browser.


回答1:


Basically, the https://play.... is just a web URL. I suspect the way this works (which is the way standard way Android works) is:

  1. The Market Play App registers to be able to handle URLs of this kind (you can register to handle certain intents, and apply filters to further define what your app will handle).
  2. The app launches the Intent with the https://play... URL
  3. The User is presented with a list of all apps that are registered to handle that intent. SO, the User is able to launch the Play App - the first time (on the phone) the https:\play... intent is launched
  4. When the user chooses which app to fulfill the Intent, if they select Browser (then set it as a default) - the Browser will launch (and will not offer the user the option the next time).
  5. This default can be by: "Settings\Applications\All - Then find the Browser App, select it, and then select Clear Defaults"

You can either call the Play Market directly with the market intent, or use the URL way. I personally use the URL way - even though there are some additional challenges to use it (like handling this particular issue).




回答2:


Use target="_top"

 <a href="market://details?id={package_name}" target="_top">App</a>



回答3:


My guess would be that the behaviour is enforced by Google. Redirects would potentially make it easier for developers with bad intentions to install their apps. Google probably checks if the user comes from a redirect, and if yes it doesn't trigger opening of the Play app.



来源:https://stackoverflow.com/questions/10401247/opening-app-in-google-play-from-a-redirect-link

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