Hi,
I want to open a URL in the users preferred browser if he has one, and in the stock browser otherwise.
Currently I already have some code that opens URLs in stock browser or any other browser if no stock browser is found:
So what's missing is to figure out whether the user has set a preferred browser and which.
Any ideas on how this could be achieved?
I want to open a URL in the users preferred browser if he has one, and in the stock browser otherwise.
Currently I already have some code that opens URLs in stock browser or any other browser if no stock browser is found:
B4X:
Sub OpenBrowser(URL As String)
Dim pm As PackageManager
Dim i As Intent
i.Initialize(i.ACTION_VIEW, URL)
i.SetType("text/html")
i.AddCategory("android.intent.category.BROWSABLE")
Dim activities As List = pm.QueryIntentActivities(i)
For Each cn As String In activities
i.SetComponent(cn)
If cn == "com.android.browser/.BrowserActivity" Then
Exit
End If
Next
StartActivity(i)
End Sub
So what's missing is to figure out whether the user has set a preferred browser and which.
Any ideas on how this could be achieved?