title: Cannot enable administrator component
body: <p>I am trying to set the lock task packages but <code>IsAdminActive</code> is returning false.</p>
  
  <p>To set the device owner and active admin I used the command <code>dpm set-device-owner PinningTest.PinningTest/.AdminReceiverTest</code> from the adb shell. This completed successfully.</p>
  
  <p>My MainActivity:</p>
  
  <pre><code>    protected override void OnCreate(Bundle bundle)
      {
          base.OnCreate(bundle);
  
          DevicePolicyManager devicePolicyManager = (DevicePolicyManager)GetSystemService(Context.DevicePolicyService);
          ComponentName testDeviceAdmin = new ComponentName(this, Java.Lang.Class.FromType(typeof(AdminReceiverTest)).Name);
  
          if (devicePolicyManager.IsAdminActive(testDeviceAdmin))
          {
              devicePolicyManager.SetLockTaskPackages(testDeviceAdmin, new string[] { PackageName }); 
          }
      }
  </code></pre>
  
  <p>My AndroidManifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" 
            package="PinningTest.PinningTest" 
            android:versionCode="1" android:versionName="1.0" 
            android:installLocation="auto"&gt;
      &lt;uses-sdk android:minSdkVersion="21" /&gt;
      &lt;uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" /&gt;
      &lt;application android:label="PinningTest"&gt;
          &lt;receiver android:name=".AdminReceiverTest" 
                android:label="@string/ApplicationName" 
                android:description="@string/ApplicationName" 
                android:permission="android.permission.BIND_DEVICE_ADMIN"&gt;
              &lt;meta-data android:name="android.app.device_admin" android:resource="@xml/device_admin" /&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>AdminReceiverTest.cs:</p>
  
  <pre><code>namespace PinningTest
  {
      class AdminReceiverTest : DeviceAdminReceiver
      {
      }
  }
  </code></pre>
  
  <p>I was following the tutorial <a href="http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/" rel="nofollow noreferrer">here</a> and have also looked at various others but I haven't been able to find a complete Xamarin example.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Many thanks.</p>