【发布时间】:2018-12-19 14:13:17
【问题描述】:
我正在尝试从应用程序中清除数据,而我的应用程序是设备所有者,因此我收到错误
java.lang.SecurityExeception : 禁止清除 DeviceOwner 数据。
我使用的代码是
public void onClearData(View view) {
try {
boolean isCleared = ((ActivityManager) getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData();
if (!isCleared) {
Toast.makeText(this, "Not able to clear the data", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
现在,我的问题是如何从应用程序中清除设备所有者应用程序的数据?不胜感激。
【问题讨论】: