Android Question Opening default browser with headers


Well-Known Member
Licensed User
Longtime User
Inside my app's webView, I successfully login to a https site, and I get its cookie and other extra headers.
However, the next step of the app, is that user enters his credit cards details, and I really don't want this to be done inside my app.
I prefer this to be done in the external default android browser.
So, my question is if and how I can open the desired uri adding the needed headers.

I found this code:

  Intent browserIntent = new Intent(
               Intent.ACTION_VIEW, Uri.parse(url));
       Bundle bundle = new Bundle();
       bundle.putString("iv-user", username);
       browserIntent.putExtra(Browser.EXTRA_HEADERS, bundle);

Haven't test it, but in order to do so, I would prefer to not create a lib for generating the bundle needed.

Any ideas? Thank you.


Well-Known Member
Licensed User
Longtime User
Dim in As Intent
in.Initialize(in.ACTION_VIEW, url)
Dim bundle As JavaObject
bundle.InitializeNewInstance("android.os.Bundle", Null)
Bundle.RunMethod("putString", Array("iv-user", username))
in.PutExtra("", Bundle)
Thank you Erel. I've done it using inline Java but yours is better. However, and unfortunately, this thing didn't work, cause I couldn't really pass the whole cookie. Default browser denied this, so the whole code is actually about EXTRA headers, thus, I couldn't make it work :(
If anyone knows a workaround I would be most happy to know.
Upvote 0