Search code examples
androidaccountmanager

Undoing google account access confirmation on android app


I'm using the code as explained in Authenticating against App Engine from an Android app to enable Google accounts auth on my GAE application. The problem is that once I've allowed my android app to access an account I'm not being able to repeat the process again (for testing) using the same account. I've tried:

  • invalidateAuthToken()
  • Clear data (Settings => Applications => Manage applications)
  • Uninstalling that app

But the app is still gaining access to that account. Below is the code snippet i use show the intent for user confirmation:

private class GetAuthTokenCallback implements AccountManagerCallback<Bundle> {
    public void run(AccountManagerFuture<Bundle> result) {
        Bundle bundle;
        try {
            bundle = result.getResult();
            Intent intent = (Intent)bundle.get(AccountManager.KEY_INTENT);
            if(intent != null) {
                // User input required
                startActivity(intent);
            } else {
                onGetAuthToken(bundle);
            }
        } catch (OperationCanceledException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (AuthenticatorException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
};

Have anyone faced this? Any idea how to force confirmation on the next run?


Solution

  • Those permissions are kept in a system database. Your app should be removed after you uninstall it, but clearing the app data doesn't have any effect. If it is not working, might be a bug. Try on a different device and/or the emulator. The extreme measure that would probably work is factory reset :)