Android intent to open user's preferred browser

后端 未结 6 779
梦如初夏
梦如初夏 2020-12-15 08:35

I\'ve been trying to find out how to create an intent that will open the user\'s preferred browser without specifying the URL. I know how to open it by giving a specific URL

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 08:50

    This is a late answer, but looks like this functionality is available in API 15:

      Intent browser = Intent.makeMainSelectorActivity(
             Intent.ACTION_VIEW, 
             Intent.CATEGORY_APP_BROWSER);
    
      startActivity(browser);
    

    Docs for makeMainSelectorActivity

提交回复
热议问题