我試圖檢索密碼的谷歌帳戶,但得到 安全異常在字符串pwd = AccountManager.get(mContext).getPassword(帳戶)。 另外我已經在androidManifest.xml中給予了權限爲 account_manager,aunthenticator,get_account,管理帳戶。SecurityException中的accountManager中的getPassword android
代碼:
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);
}
===================================== ========================================
例外:
6月8日至4日:38:30.821:WARN/AccountManagerService(2248):呼叫者UID 1000 大於認證者的UID不同
6月8日至4日:38:30.821:INFO/parul(2804):異常拋出有分噸 經理try塊
08-04 06:38:30.821:WARN/System.err的(2804):java.lang.SecurityException異常:呼叫者UID 1000比 認證者的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):在 android.os.Parcel.readException(Parcel.java:1206)
六月8日至4日:38:30.821:WARN/System.err的(2804 ):在 android.accounts.IAccountManager $存根 $ Proxy.getPassword(IAccountManager.java:397)
6月8日至四日:38:30.821:WARN/System.err的(2804):在 android.accounts .AccountManager.getPassword(AccountManager.java:157)
=================================== ==========================================
如果有人知道爲什麼我得到這個問題PLZ的幫助。 謝謝