Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening app in Google Play from a redirect link

Tags:

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.

like image 707
nicobatu Avatar asked May 01 '12 16:05

nicobatu


People also ask

Can I open Android app from URL?

First of all you need to add intent filters for incoming links. Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search. Add one or more tags, each of which represents a URI format that resolves to the activity. At minimum, the tag must include the android:scheme attribute.

How do I redirect a URL to the app?

Once you build a link with same signature as mentioned in manifest The android system will add your app in chooser to open link in your app and you will get the data in "getIntent(). getData()" in respective Activity. If app is not installed the link will itself open in browser. Then handle it on browser .

Can a link open an app?

Overview of Android App LinksApp Links use HTTP URLs associated with your website domain, and allow a specific app to be the default owner of a given type of link. This ensures that no other app can use your links for deep linking.


2 Answers

Use target="_top"

 <a href="market://details?id={package_name}" target="_top">App</a> 
like image 83
Jokry Avatar answered Nov 16 '22 04:11

Jokry


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

like image 33
Booger Avatar answered Nov 16 '22 03:11

Booger