当前位置: 首页>>代码示例>>Java>>正文


Java DevicePolicyManager.removeActiveAdmin方法代码示例

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

}
 
开发者ID:firebirdberlin,项目名称:nightdream,代码行数:9,代码来源:PreferencesFragment.java

示例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);
}
 
开发者ID:rosenpin,项目名称:AlwaysOnDisplayAmoled,代码行数:16,代码来源:PreferencesActivity.java

示例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;
}
 
开发者ID:Andre1299,项目名称:TUI-ConsoleLauncher,代码行数:15,代码来源:tui.java

示例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);
}
 
开发者ID:msimonides,项目名称:homerplayer,代码行数:8,代码来源:HomerPlayerDeviceAdmin.java

示例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);
}
 
开发者ID:akexorcist,项目名称:Example-SamsungSDK,代码行数:6,代码来源:KnoxActivationManager.java

示例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);
}
 
开发者ID:zqWu,项目名称:cordova_pulgin_mdm,代码行数:7,代码来源:PluginMdm.java


注:本文中的android.app.admin.DevicePolicyManager.removeActiveAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。