Last active
October 18, 2022 12:16
-
-
Save vishalkardode/51edd62d3545febe70f7 to your computer and use it in GitHub Desktop.
WebkitCookieManagerProxy for Android sharing cookies between java.net.cookiemanager and android.webkit.cookiemanager taken from http://stackoverflow.com/questions/12731211/pass-cookies-from-httpurlconnection-java-net-cookiemanager-to-webview-android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*SET cookie manager for webkit* | |
android.webkit.CookieSyncManager.createInstance(appContext); | |
// unrelated, just make sure cookies are generally allowed | |
android.webkit.CookieManager.getInstance().setAcceptCookie(true); | |
*SET cookie manager for java.net (native calls)* | |
// magic starts here | |
WebkitCookieManagerProxy coreCookieManager = new WebkitCookieManagerProxy(null, java.net.CookiePolicy.ACCEPT_ALL); | |
java.net.CookieHandler.setDefault(coreCookieManager); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment