tags:

views:

20

answers:

1

Hello! 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!

+1  A: 

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.

CommonsWare
So it is impossible to do it with the usual browser? Then, the WebView option is the way to go.
Julian Assange
@Julian Assange: I am not aware that it is possible with "the usual browser". And some devices will replace that browser. And some users will replace that browser. The odds of all of them having agreed upon an undocumented protocol to accept cookies via `Intent` extras are fairly low.
CommonsWare
@CommonsWare: Okey thank you. Another question appeared, but I will take that in another question. It is about the Cookie injection itself, that doesnt work.
Julian Assange