How to listen for any cookie changes in Android Webview -
my application using webview open webpage updating few cookies on interactions taken on webpage. want read cookie , make ui tweaks based on value of cookie.
ios has implementation of observers can attached cookies list , notifications cookie change happens.
i searching similar solution long not find kind of listeners or can attached cookies , know when updated.
i read in cookiemanager
, cookiesyncmanger
https://developer.android.com/reference/java/net/cookiemanager.html
https://developer.android.com/reference/java/net/cookiemanager.html
but nothing helpful.
i know using javascript interface hooks better solution can't implemented website running in production.
i believe need go 1 layer deeper. cookiestore
- https://developer.android.com/reference/java/net/cookiestore.html you're looking for. can create own implementation overriding add(), get(), remove(), etc. , include own callback there.
there's post here covers how shared preferences backed implementation - how persist cookies when using httpurlconnection?, can roll own , want. (and yes, it's still relevant retrofit - retrofit , persistent cookie store)
sorry that, same class name, different package - android.webkit.cookiemanager not java.net.cookiemanager. took @ associated code android.webkit.cookiemanager & android.webkit.webviewfactory.
the cookiemanager provided webviewfactoryprovider instance. not appear possible desire without serious hacking.
i checked crosswalk, has xwalkcookiemanager. might work you, it's not i've tried, , drastically increase apk size.
Comments
Post a Comment