I'm developing an application on Android and I want to allow users to log in with their google account. I managed the login but I am having problems with logout. I have a navigation drawer with the logout option in the end. Can someone help me implement logout?
I tried the code from https://developers.google.com/identity/sign-in/android/disconnect but it didn't work.
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]
}
});
}
}