本文整理汇总了Java中android.app.admin.DevicePolicyManager.removeActiveAdmin方法的典型用法代码示例。如果您正苦于以下问题:Java DevicePolicyManager.removeActiveAdmin方法的具体用法?Java DevicePolicyManager.removeActiveAdmin怎么用?Java DevicePolicyManager.removeActiveAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.admin.DevicePolicyManager
的用法示例。
在下文中一共展示了DevicePolicyManager.removeActiveAdmin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeActiveAdmin
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
private void removeActiveAdmin() {
DevicePolicyManager mgr = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName cn = new ComponentName(mContext, AdminReceiver.class);
if ( mgr.isAdminActive(cn)) {
mgr.removeActiveAdmin(cn);
}
}
示例2: uninstall
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
public static void uninstall(Context context, Prefs prefs) {
try {
ComponentName devAdminReceiver = new ComponentName(context, DAReceiver.class);
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.removeActiveAdmin(devAdminReceiver);
if (prefs.proximityToLock && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && !Shell.SU.available())
prefs.setBool(Prefs.KEYS.PROXIMITY_TO_LOCK.toString(), false);
} catch (Exception ignored) {
}
Uri packageUri = Uri.parse("package:" + context.getPackageName());
Intent uninstallIntent =
new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
uninstallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(uninstallIntent);
}
示例3: exec
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
@Override
public String exec(ExecutePack pack) {
MainPack info = (MainPack) pack;
DevicePolicyManager policy = (DevicePolicyManager) info.context.getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName name = new ComponentName(info.context, PolicyReceiver.class);
policy.removeActiveAdmin(name);
Uri packageURI = Uri.parse("package:" + BuildConfig.APPLICATION_ID);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
info.context.startActivity(uninstallIntent);
return null;
}
示例4: clearDeviceOwnerAndAdmin
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
public static void clearDeviceOwnerAndAdmin(Context context) {
DevicePolicyManager dpm =
(DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.clearDeviceOwnerApp(context.getPackageName());
ComponentName adminComponentName = new ComponentName(context, HomerPlayerDeviceAdmin.class);
dpm.removeActiveAdmin(adminComponentName);
}
示例5: deactivateDeviceAdmin
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
public void deactivateDeviceAdmin(Context context) {
DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName componentName = new ComponentName(context, AdminActivationReceiver.class);
devicePolicyManager.removeActiveAdmin(componentName);
}
示例6: inactivate
import android.app.admin.DevicePolicyManager; //导入方法依赖的package包/类
private void inactivate() {
CordovaActivity act = (CordovaActivity) this.webView.getContext();
ComponentName devAdminReceiver = MdmExecutor.getInstance().getAdminName();
DevicePolicyManager dpm = (DevicePolicyManager) act.getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.removeActiveAdmin(devAdminReceiver);
}