2
votes

I am trying to show a app chooser dialog using Intent.createChooser, that will list all available web browsers in user's phone. I'm using the code below:

        Intent browserIntent = new Intent(Intent.ACTION_VIEW);
        browserIntent.setData(Uri.parse(category));
        // Create and start the chooser
        Intent chooser = Intent.createChooser(browserIntent, "Open with...");

        pIntent = PendingIntent.getActivity(helperMethodContext, 0, chooser, PendingIntent.FLAG_UPDATE_CURRENT);

        Log.d("HelperMethods: ", "video chat url: " + category);  

I am testing this on android 6. My phone has 3 browsers, default browser, chrome and firefox. When i run it and click on the link(the notification), app chooser dialog opens but only shows default browser. It doesn't show chrome or firefox.

app chooser dialog after clicking on link in notification

I have checked default apps settings in my phone and there is no default browser. When i click default browser it opens with an app chooser dialog showing all the browser apps i have installed on my phone.

Pls can someone tell me where am i going wrong.

1
@JaydeepPatel i don't want to open default browser when the link is clicked. I want to show the app chooser dialog with a list of all the installed browsers - sissyphus_69
@JaydeepPatel I don't have default browser set in default apps settings. pls read the question completely. - sissyphus_69

1 Answers

0
votes

There is so important what type of uri do you have. Is it http, https or other scheme. In your case it's Uri.parse(category). For example firefox can handle scheme like: http, https, file, about, javascript, package. And also data with mimeType: text/html, text/plain and application/xhtml+xml.