How do you force AccountManager to show the “Access Request” screen after a user has already allowed access?

The only solution I’ve found is to manually clear out the data stored in the system’s accounts.db. Run the following from the command line to clear out all account grants on the system. For the emulator: adb -e shell ‘sqlite3 /data/system/accounts.db “delete from grants;”‘ For a device (must be rooted and have the sqlite3 binary … Read more

How do I retrieve the logged in Google account on android phones?

Something like this should work: AccountManager manager = (AccountManager) getSystemService(ACCOUNT_SERVICE); Account[] list = manager.getAccounts(); String gmail = null; for(Account account: list) { if(account.type.equalsIgnoreCase(“com.google”)) { gmail = account.name; break; } } And you will need the following permission in your manifest: <uses-permission android:name=”android.permission.GET_ACCOUNTS”></uses-permission> Remember to ‘Requesting Permissions at Run Time’ if you support Android 6 and … Read more

What should I use Android AccountManager for?

This question is a bit old, but I think it is still of good interest. AccountManager, SyncAdapter and ContentProvidergo together. You cannot have a SyncAdapter without an Account in the AccountManager. You cannot have a SyncAdapterwithout a ContentProvider. But you can: use the ContentProvider without the others. use the AccountManager without the others (but you … Read more