Get Preferred/Default app on Android
I am trying to get the default/preferred application for a given Intent . For example, when the user installs a second web browser, then attempts to open a URL, he or she will get a dialog like this: If the user then selects the Use by default for this action option, then the dialog box no longer opens when a URL is pressed. I am working on an application that should be aware of what this default or preferred app/action is. How do I do this? I am currently using the code below, but getPreferredPackage doesn't return anything: Intent i = (new Intent(Intent.ACTION_VIEW, Uri.parse("https://www