Skip to content Skip to sidebar Skip to footer

How To Forcefully Remove Google Default Selected Account In Gmail Api?

I am trying to remove default selected account from gmail api when logout from app in android. this is GoogleAccountCredential function to establish connection of gmail account. G

Solution 1:

I was tired also, but I have found the solution; If google account is already login after remove default selected account from Gmail API. follow this step...

 SharedPreferences.Editoreditor= getPreferences(Context.MODE_PRIVATE).edit();
 editor.putString(PREF_ACCOUNT_NAME, null);
 editor.commit(); 

update the value of preferences from particular Key "PREF_ACCOUNT_NAME"

~Thanks

Solution 2:

Gmail API doesn't Provide And default account select method you can just call this method to select account when required

startActivityForResult(
        mCredential.newChooseAccountIntent(),
        REQUEST_ACCOUNT_PICKER);

just remember to pass null to mCredential when logout

Post a Comment for "How To Forcefully Remove Google Default Selected Account In Gmail Api?"