How Can I Set The Google Chrome As A Default Browser Of The Application That I Make Programmatically
Solution 1:
Do not set class name on the intent. If there is only one app that handles that url, this app will be started. If there are more than one apps, and the user has not chosen a default one yet, this will prompt the user. If the user has chosen one already, this will start the user preferred one. It's always a good idea to let the user choose which browser they want to use. It might turn out that Chrome plain does not work for them for any number of reasons; for example the user might need to use special browser due to specific disability.
If you still want to explicitly launch Google Chrome, you'll have to find its package name (com.android.chrome
:-)) and the activity that handles the android.intent.action.VIEW
action. You can find this from the Google Chrome manifest, which is stored in it's .apk. You will need to extract this from a device that has it installed.
Note however, that there is zero guarantee that Google Chrome will be present on the device, even if the device is running JB 4.2. OEMs have freedom (to a certain degree) to customize the list of packages installed on the device, so even if the standard 4.2 GMS image includes Chrome, Samsung for example might still decide to remove it. Not to mention that devices based on 4.2 AOSP will likely never have Chrome, as it is not part of the open source Android platform, and users can't download it from Google Play Store, as that one is also not part of AOSP. (I am intentionally dismissing the scenario of AOSP-based device that includes Google Play, Google Maps, and Chrome in its image without proper GMS license)
Post a Comment for "How Can I Set The Google Chrome As A Default Browser Of The Application That I Make Programmatically"