Can I use cookies from my own browser in my WebView application?

I want users to visit my site using their phone to receive cookies from me. Later, when they use my application, I want them to use the same cookie from a previous session.

Is it possible?

If not, is there another way to maintain state information between browser sessions and application sessions?

Thank you for your time!

+4
source share
3 answers

From the Android documentation ( http://developer.android.com/reference/android/webkit/WebView.htm l )

Cookie and window management

For obvious security reasons, your application has its own cache, cookie storage, etc. - It does not use browser application data. Cookies are managed in a separate thread, so operations such as building an index do not block the user interface stream. Follow the instructions in CookiesyncManager if you want to use cookies in your application.

So, the short answer is no, you cannot access anything that the main browser stores in your WebView application.

I'm not quite sure what you can do to get around this. Can't you just save the session data on your server in the database and associate it with the user account. Then you can have an application for storing their data for login and automatic login, which means that they will not need to enter a username / password each time they use the application, and it can simply synchronize their session data every time . To the user, it should look pretty smooth.

+6
source

If they use web browsing in your application, then you can get and save a cookie for reuse in your application, for example. to call the web service.

But if you want to get a cookie from the main Android web browser, I don’t think it is possible.

0
source

As far as I know, this is not possible (I was looking for the same thing). There are solutions that try to identify users statistically and should be able to create the same user ID both in applications and in the browser (you can check AdTruth )

0
source

All Articles