How to log out of a Google user in an Android application on the button Click on Java?

I managed to log in to the user (ask for their approval, and then allow them to do other protected things), and now I want to clear their username or, in other words, log out by pressing the button.

Is there a way I could upload a webview? I know that other sites have something like https://somewebsite.com/logout where people go out.

Please help me with this. Thanks in advance!

+4
source share
2 answers

I figured out a way to clear everything. I hope someone finds this useful!

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

Source: https://habr.com/ru/post/1525730/


All Articles