Revisions
-
kosso created this gist
Oct 21, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ // Use to clear all cookies from webViews // - Very useful when logging in users via third party webView login forms. // Kosso // October 2012 /* Usage: var cookiejar = require('com.hashpan.cookiedroid'); cookiejar.clearCookies(); */ package com.hashpan.cookiedroid; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiApplication; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.app.Activity; import android.content.Context; @Kroll.module(name="Cookiedroid", id="com.hashpan.cookiedroid") public class CookiedroidModule extends KrollModule { public CookiedroidModule() { super(); } @Kroll.onAppCreate public static void onAppCreate(TiApplication app) { } // Methods @Kroll.method public void clearCookies() { Activity acti = getActivity(); Context context = acti.getBaseContext(); CookieSyncManager.createInstance(context); CookieManager.getInstance().removeAllCookie(); } }