Android Question Open Chrome browser in sepesific page

Devv

Active Member
Licensed User
Longtime User
I'm trying to open a specific link in google chrome

i tried this (with no luck)

B4X:
    Dim pi As Intent
    'Dim pm As PackageManager
     pi.Initialize(pi.ACTION_VIEW,"http://google.com")
      pi.SetComponent("com.android.browser/.BrowserActivity")
      pi.SetType("text/html")
    StartActivity(pi)



i found this , but i couldnt convert it to B4A
B4X:
String urlString="http://mysuperwebsite";
Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.android.chrome");
try {
    context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
    // Chrome browser presumably not installed so allow user to choose instead
    intent.setPackage(null);
    context.startActivity(intent);
}


any ideas ?
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
private Browser As Intent
Browser.Initialize(Browser.ACTION_VIEW, "https://www.b4x.com")
Browser.SetComponent("com.android.chrome/com.google.android.apps.chrome.Main")
StartActivity(Browser)
 
Upvote 0
Top