Eenvincible
Eenvincible

Reputation: 5626

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!

Upvotes: 4

Views: 3467

Answers (2)

Eenvincible
Eenvincible

Reputation: 5626

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();
}

Upvotes: 5

class
class

Reputation: 8681

Follow these Android signout instructions on the Google+ developer site to sign out the user and let them switch accounts or be logged out.

Upvotes: 1

Related Questions