Android 如何以编程方式从移动设备中删除google帐户
我想从我的应用程序中单击一个按钮就删除google帐户,但我遇到了以下安全异常,此时应用程序崩溃。因此,如果有任何可能的方法,请指导我Android 如何以编程方式从移动设备中删除google帐户,android,google-account,Android,Google Account,我想从我的应用程序中单击一个按钮就删除google帐户,但我遇到了以下安全异常,此时应用程序崩溃。因此,如果有任何可能的方法,请指导我 java.lang.SecurityException: uid 10511 cannot remove accounts of type: com.google 这是我正在使用的代码 public static void removeAccount(Context mContext){ AccountManager am = Account
java.lang.SecurityException: uid 10511 cannot remove accounts of type: com.google
这是我正在使用的代码
public static void removeAccount(Context mContext){
AccountManager am = AccountManager.get(mContext);
MainActivity activity;
activity=(MainActivity)mContext;
Handler handler=new Handler();
Account[] accounts = am.getAccounts();
if (accounts.length > 0) {
Account accountToRemove = accounts[0];
am.removeAccount(accountToRemove, null, null);
}
}
提前感谢您的帮助。您找到解决方案了吗?我也在寻找这种类型的解决方案,如果有人发现了这个问题,请告诉我