Search code examples
androidoauth-2.0google-plusscribe

How To Logout a Google User in my Android Application on Button Click In Java?


I have been successful at Login in a user (asking for their approval and then letting them do some other protected stuff) and now I want to clear their login or in other words, Log them out when they click a button.

Is there a path that I could load a webview? I know other sites have something like https://somewebsite.com/logout which logs people out.

Please help me on this. Thanks in advance!


Solution

  • I figured out a way to clear everything. I hope someone else finds it useful!

    public void clearCookies(){
        CookieSyncManager.createInstance(GooglePlusActivity.this);
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
    }