• <bdo id='kD9W5'></bdo><ul id='kD9W5'></ul>
  • <i id='kD9W5'><tr id='kD9W5'><dt id='kD9W5'><q id='kD9W5'><span id='kD9W5'><b id='kD9W5'><form id='kD9W5'><ins id='kD9W5'></ins><ul id='kD9W5'></ul><sub id='kD9W5'></sub></form><legend id='kD9W5'></legend><bdo id='kD9W5'><pre id='kD9W5'><center id='kD9W5'></center></pre></bdo></b><th id='kD9W5'></th></span></q></dt></tr></i><div id='kD9W5'><tfoot id='kD9W5'></tfoot><dl id='kD9W5'><fieldset id='kD9W5'></fieldset></dl></div>

    <legend id='kD9W5'><style id='kD9W5'><dir id='kD9W5'><q id='kD9W5'></q></dir></style></legend>

      <small id='kD9W5'></small><noframes id='kD9W5'>

    1. <tfoot id='kD9W5'></tfoot>

      1. Android:以编程方式从设备管理员中删除我的应用程序?

        时间:2024-04-13
          • <i id='jlH3k'><tr id='jlH3k'><dt id='jlH3k'><q id='jlH3k'><span id='jlH3k'><b id='jlH3k'><form id='jlH3k'><ins id='jlH3k'></ins><ul id='jlH3k'></ul><sub id='jlH3k'></sub></form><legend id='jlH3k'></legend><bdo id='jlH3k'><pre id='jlH3k'><center id='jlH3k'></center></pre></bdo></b><th id='jlH3k'></th></span></q></dt></tr></i><div id='jlH3k'><tfoot id='jlH3k'></tfoot><dl id='jlH3k'><fieldset id='jlH3k'></fieldset></dl></div>
            <legend id='jlH3k'><style id='jlH3k'><dir id='jlH3k'><q id='jlH3k'></q></dir></style></legend>

            <tfoot id='jlH3k'></tfoot>

              <tbody id='jlH3k'></tbody>
              <bdo id='jlH3k'></bdo><ul id='jlH3k'></ul>

              1. <small id='jlH3k'></small><noframes id='jlH3k'>

                • 本文介绍了Android:以编程方式从设备管理员中删除我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm trying to add a button to my app to remove it from Device Administrator and am using the code below but my app just crashes.

                  Code:-

                  On Button Click:-

                  {
                      ComponentName devAdminReceiver = new ComponentName(this, DemoDeviceAdminReceiver.class);
                      DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
                      dpm.removeActiveAdmin(devAdminReceiver);
                  }
                  

                  In the code above, DemoDeviceAdminReceiver is a class that extends DeviceAdminReceiver.

                  Error log:-

                  10-28 15:26:09.295: E/AndroidRuntime(26101): FATAL EXCEPTION: main
                  10-28 15:26:09.295: E/AndroidRuntime(26101): java.lang.IllegalArgumentException: Unknown admin: ComponentInfo{com.dragonnis.intellicover/com.dragonnis.intellicover.DemoDeviceAdminReceiver}
                  10-28 15:26:09.295: E/AndroidRuntime(26101):    at android.os.Parcel.readException(Parcel.java:1331)
                  10-28 15:26:09.295: E/AndroidRuntime(26101):    at android.os.Parcel.readException(Parcel.java:1281)
                  10-28 15:26:09.295: E/AndroidRuntime(26101):    at android.app.admin.IDevicePolicyManager$Stub$Proxy.removeActiveAdmin(IDevicePolicyManager.java:2940)
                  10-28 15:26:09.295: E/AndroidRuntime(26101):    at android.app.admin.DevicePolicyManager.removeActiveAdmin(DevicePolicyManager.java:183)
                  

                  解决方案

                  It's as you do:

                  DevicePolicyManager mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
                  mDPM.removeActiveAdmin(mDeviceAdminReceiver);
                  

                  But you need to add these filters to the receiver in AndroidManifest.xml:

                      <intent-filter>
                          <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
                          <action android:name="android.app.action.DEVICE_ADMIN_DISABLED" />
                      </intent-filter>
                  
                  
                  @Override
                  public CharSequence onDisableRequested(Context context, Intent intent) {
                      return "Admin rights are beeing requested to be disabled for the app called: '" + context.getString(R.string.app_name) + "'.";
                  }
                  

                  这篇关于Android:以编程方式从设备管理员中删除我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Android 对话框编号选择器 下一篇:React Native 0.57.x &lt;Image/&gt;大图像低质量

                  相关文章

                  <i id='vfgvH'><tr id='vfgvH'><dt id='vfgvH'><q id='vfgvH'><span id='vfgvH'><b id='vfgvH'><form id='vfgvH'><ins id='vfgvH'></ins><ul id='vfgvH'></ul><sub id='vfgvH'></sub></form><legend id='vfgvH'></legend><bdo id='vfgvH'><pre id='vfgvH'><center id='vfgvH'></center></pre></bdo></b><th id='vfgvH'></th></span></q></dt></tr></i><div id='vfgvH'><tfoot id='vfgvH'></tfoot><dl id='vfgvH'><fieldset id='vfgvH'></fieldset></dl></div>

                      <bdo id='vfgvH'></bdo><ul id='vfgvH'></ul>

                      <tfoot id='vfgvH'></tfoot>

                      <small id='vfgvH'></small><noframes id='vfgvH'>

                    1. <legend id='vfgvH'><style id='vfgvH'><dir id='vfgvH'><q id='vfgvH'></q></dir></style></legend>