Web view clear cookies and cache

103 views
Skip to first unread message

kwellman

unread,
Apr 24, 2014, 4:43:32 PM4/24/14
to apportabl...@googlegroups.com
Hello,
I'm using a UIWebView in my app. It's important that I delete all cookies and reset the cache when I load it up. It works fine on iOS with the following code:

    // clear cache

    [[NSURLCache sharedURLCache] removeAllCachedResponses];

  

    // clear all cookies

    NSHTTPCookie *cookie;

    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];

    for (cookie in [storage cookies]) {

        [storage deleteCookie:cookie];

    }

Unfortunately, this code doesn't seem to do anything on Android after compiling with Apportable. The cookies are still present and responses in cache.

Is there any way of achieving this in a way that works on Android using Apportable?

Thanks.

Philippe Hausler

unread,
Apr 24, 2014, 6:42:28 PM4/24/14
to apportabl...@googlegroups.com, kwellman
UIWebView does not use NSURLConnection in our implementation: it uses Android’s web view so cookie storage and cache are managed by the Android subsystem.
--
You received this message because you are subscribed to the Google Groups "Apportable discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apportable-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kwellman

unread,
Apr 24, 2014, 7:29:04 PM4/24/14
to apportabl...@googlegroups.com, kwellman
Thanks for your response.

So is there any way to clear the cookies and cache? I've been reading about BridgeKit and the Android SDK and it seems like I can clear the cookies by using the CookieManager class in java. Is this the right way to go about it?

I've also noticed that the app crashes when the web view autocomplete pops up in Android. A workaround would be to disable the autocomplete. To do that it looks like I need the Android WebView instance in order to modify its settings using BridgeKit. However, I'm not sure how to access the WebView instance in my java code. Is there an example somewhere that I could refer to?

Thanks.

To unsubscribe from this group and stop receiving emails from it, send an email to apportable-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages