0

I have a String url. The requirement : On Click of a Button, the default chooser should open if the deeplinked App is installed with the User else opens the browser.

I am doing this onClick of the Button:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url);
startActivity(i);

The onClick opens the browser only, evenif the deeplinked App is installed. What should be the approach?

asdec90
  • 1,070
  • 2
  • 13
  • 28
  • you can use share option. – dipali Jul 11 '16 at 07:15
  • you need to see this : [Make a link in the Android browser start up my app?](http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app) – Janki Gadhiya Jul 11 '16 at 07:19
  • 1
    use:http://stackoverflow.com/questions/13518453/android-redirect-to-store-if-app-not-installed-launch-from-website – dipali Jul 11 '16 at 07:20
  • Take a look at this answer -http://stackoverflow.com/questions/3872063/launch-an-application-from-another-application-on-android – niranjan_b Jul 11 '16 at 09:07

1 Answers1

0
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url);
startActivity(i);

The above code worked in case of deep-linked URL. The default chooser gave option for the App.

asdec90
  • 1,070
  • 2
  • 13
  • 28