Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass cookie to browser via Intent

Tags:

java

android

I have saved a cookie in android. Now I want to pass it into my browser intent. Look at my current code:

Intent browser = new Intent("android.intent.action.VIEW",
                            Uri.parse("http://mypage.php/memberpagethatrequireacookie.php"));
//putExtra cannot take these arguments -> browser.putExtra("org.apache.http.cookie.Cookie", cookie);
startActivity(browser);

I want it to store temporarily in my browser so my member page loads successfully. My cookie are successfully created from the HTTP request and I assign it to a List<Cookie> cookie; Tell me if I should provide some more code.

Any ideas? Thanks in advance!

like image 895
Curtain Avatar asked Sep 15 '10 11:09

Curtain


1 Answers

The Browser has no documented Intent extras, let alone one that would allow you to inject a cookie. And, of course, the user might be using a different browser.

You are welcome to use WebView in your application, and you can use the CookieManager to inject your cookie into the WebView's environment.

like image 110
CommonsWare Avatar answered Oct 31 '22 21:10

CommonsWare