2

all I'm very confused with this scenario.
I need to open a link using default android browser in my app.
The link is Google Play.

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://play.google.com"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

The reason I don't use market:// is because some regions will not have Google Play apk.

It pops up a chooser dialog includes Chrome , Play Store , Browser.
After I choose Browser, default browser does launch but it pops up chooser again.
Even I choose Chrome, both will have the same action.

If I use Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.yahoo.com"));

It only pop up once and show yahoo homepage correctly.
I tried under Android 4.0.4 and 4.2

Is it correct scenario? How can I avoid it pop up twice? Thanks a lot.

ray.kc.liu
  • 43
  • 10
  • This is happening to me also with the address: `http://m.youtube.com/home`. Did you resolve? Thanks – dentex Jan 09 '14 at 13:37
  • @dentex you can explicitly set youtube class name. See this for more details: http://stackoverflow.com/a/6781064/1005846 – Dmitry Guselnikov Jan 09 '14 at 19:38
  • 2
    @elf_zwölf Well, I actually wanted to show the website, not the app. Anyway, I resolved inserting a **#**, like this: **http://m.youtube.com/#/home**. This is into the address bar after the second chooser and after a redirection. Putting directly this works well in my case. – dentex Jan 10 '14 at 08:30
  • @dentex , cool, due to my project was done, I'm not sure if it works for mine.Anyway, thanks for your sharing! – ray.kc.liu Mar 17 '14 at 07:40

1 Answers1

1

Yes, it's a correct scenario. The first pop-up because your app asks Android what app should be used, then your browser asks android should the link be opened by itself or use special application

Dmitry Guselnikov
  • 1,048
  • 1
  • 8
  • 21
  • Thanks for your explanation,guy.It seems no one else has other explanation. – ray.kc.liu Jun 05 '13 at 05:20
  • second popup actually shows with the stock browser. Not happening with Firefox. tested on two emulators (4.3 and 4.4.2) and a device (4.3.1). – dentex Jan 09 '14 at 16:47