當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。