google api - Logout for GoogleApiClient in Android application -
using such code possible link app , use account.
if (mgoogleapiclient == null) { mgoogleapiclient = new googleapiclient.builder(this) .addapi(plus.api) .addapi(drive.api) .addscope(drive.scope_file) .addscope(drive.scope_appfolder) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); } mgoogleapiclient.connect();
but way 'logout' account once activated or switch new one?
i found up-to-date solution:
if (mgoogleapiclient != null && mgoogleapiclient.isconnected()) { mgoogleapiclient.cleardefaultaccountandreconnect().setresultcallback(new resultcallback<status>() { @override public void onresult(status status) { mgoogleapiclient.disconnect(); } }); }
the usage of
plus.accountapi.cleardefaultaccount(mgoogleapiclient);
is deprecated
https://developers.google.com/android/reference/com/google/android/gms/plus/account
Comments
Post a Comment