I'm trying to retrieve the password of google account, but getting security exception at String pwd = AccountManager.get(mContext).getPassword(account). Also i have given permissions in androidManifest.xml to account_manager, aunthenticator, get_account, manage account.
code :
android.accounts.Account[] gaccounts = AccountManager.get(mContext).getAccounts();
Log.i("parul", "2222()len :"+ gaccounts.length);
for (android.accounts.Account account: gaccounts) {
String pwd = AccountManager.get(mContext).getPassword(account);
Log.i("parul", "google pwd: " + pwd);
AccountManager.get(mContext).setPassword(account, null);
String pwdcleared = AccountManager.get(mContext).getPassword(account);
Log.i("parul", "google pwdcleared: " + pwdcleared);
}
=============================================================================
Exception:
08-04 06:38:30.821: WARN/AccountManagerService(2248): caller uid 1000 is different than the authenticator's uid
08-04 06:38:30.821: INFO/parul(2804): exception thrown for account manager try block
08-04 06:38:30.821: WARN/System.err(2804): java.lang.SecurityException: caller uid 1000 is different than the authenticator's uid
08-04 06:38:30.821: WARN/System.err(2804): at android.os.Parcel.readException(Parcel.java:1218)
08-04 06:38:30.821: WARN/System.err(2804): at android.os.Parcel.readException(Parcel.java:1206)
08-04 06:38:30.821: WARN/System.err(2804): at android.accounts.IAccountManager$Stub $Proxy.getPassword(IAccountManager.java:397)
08-04 06:38:30.821: WARN/System.err(2804): at android.accounts.AccountManager.getPassword(AccountManager.java:157)
=============================================================================
If anybody is aware why i'm getting this problem plz help. Thanks