Opening app in Google Play from a redirect link

72,277

Solution 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).

Solution 2

Use target="_top"

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

Solution 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.

Share:
72,277

Related videos on Youtube

nicobatu
Author by

nicobatu

Updated on May 19, 2021

Comments

  • nicobatu
    nicobatu about 3 years

    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.

    • nicobatu
      nicobatu about 12 years
      Also strange: redirecting to market.android.com/details?id= instead of the Google Play domain allows the device to prompt to open with Play app.
    • Sulfkain
      Sulfkain about 10 years
      The problem is that the browser don't do another intent when he gets a "market://" url. So the google Play app is not able. I see on some devices, the browser do that and when you redirect to a "market://" url the googlePlay app is open. It's Browser stuff
    • Snivio
      Snivio over 4 years
      Try firebase dynamic links see if it helps in your use case
  • nicobatu
    nicobatu about 10 years
    This is not redirecting anything, it's just going straight to the market url.
  • arslan haktic
    arslan haktic over 9 years
    how can we avoid that, i want to open my app from a redirect link, but when it goes into browser it didn't open my application. Any Help?
  • abedfar
    abedfar about 8 years
    Works like a charm. I'd like to go further though. It opens the selector pop-up, from which user should select google play app from other market apps on the device. It would be very nice to skip the selector and directly open google play. Is it possible?
  • Richard Fu
    Richard Fu almost 8 years
    market:// not working in new Chrome but the rest browser in Android, anyone have a better solution?
  • 151291
    151291 about 7 years
    how to open app if already installed without redirect playstore?
  • 151291
    151291 about 7 years
    how to open app if already installed without redirect playstore?
  • Booger
    Booger about 7 years
    Ask this as a real question, not as a comment to another question.
  • Roman
    Roman over 5 years
    @arslanhaktic did you find a solution?
  • David Riha
    David Riha about 5 years
    @RichardFu you are right, it does not work if you type the url in the Chrome, but fortunately, it works if it's opened by clicking on the link, which is enough for my use case