我正在Android上開發應用程序,並且希望允許用戶使用其Google帳戶登錄。我管理登錄,但我有註銷問題。最後,我有一個帶有註銷選項的導航抽屜。有人可以幫我實現註銷嗎?Google帳戶登錄和註銷
我試過https://developers.google.com/identity/sign-in/android/disconnect的代碼,但沒有奏效。
LogoutFragment
public class LogoutFragment extends Fragment {
private GoogleApiClient mGoogleApiClient;
private TextView mStatusTextView;
private ProgressDialog mProgressDialog;
public LogoutFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
signOut();
return inflater.inflate(R.layout.fragment_logout, container, false);
}
public void signOut() {
Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// [START_EXCLUDE]
updateUI(false);
// [END_EXCLUDE]
}
});
}
}
發佈您的代碼。你有沒有嘗試過'Logout'? –
郵政編碼或即將發佈的信息將被刪除。 –
@jaydroider添加了我的代碼.. – PersianBlue