本文整理匯總了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);
}