title: Error: Unknown admin: ComponentInfo{com.demoapp.amm/DeviceAdminSample}
body: <p>I am trying this command from adb shell</p>
  
  <blockquote>
    <p>dpm set-device-owner com.demoapp.amm/DeviceAdminSample</p>
  </blockquote>
  
  <p>and i am getting this response.</p>
  
  <blockquote>
    <p>Unknown admin: ComponentInfo{com.demoapp.amm/DeviceAdminSample}</p>
  </blockquote>
  
  <p>com.demoapp.amm is my package name in Manifest file.</p>
  
  <p>Below is my receiver from Manifest file </p>
  
  <pre><code>  &lt;receiver
          android:name=".DeviceAdminSample"
          android:description="@string/sample_device_admin_description"
          android:label="@string/sample_device_admin_description"
          android:permission="android.permission.BIND_DEVICE_ADMIN" &gt;
  
          &lt;meta-data
              android:name="android.app.device_admin"
              android:resource="@xml/device_admin_sample" &gt;
          &lt;/meta-data&gt;
  
          &lt;intent-filter&gt;
              &lt;action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt; 
  </code></pre>
  
  <p>Below is My Class DeviceAdminSample.class</p>
  
  <pre><code>package com.demoapp.amm;
  import android.app.admin.DeviceAdminReceiver;
  import android.content.ComponentName;
  import android.content.Context;
  import android.content.Intent;
  import android.widget.Toast;
  
  
  public class DeviceAdminSample extends DeviceAdminReceiver {
  
  void showToast(Context context, String msg) {
  
      Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
  }
  
  @Override
  public void onEnabled(Context context, Intent intent) {
      showToast(context,"Enabled");
  }
  
  @Override
  public CharSequence onDisableRequested(Context context, Intent intent) {
      return "Disabled";
  }
  
  @Override
  public void onDisabled(Context context, Intent intent) {
      showToast(context, "Disabled");
  }
  
  @Override
  public void onPasswordChanged(Context context, Intent intent) {
      showToast(context,"Password Change");
  }
  
  public static ComponentName getComponentName(Context context) {
      return new ComponentName(context.getApplicationContext(), 
  DeviceAdminSample.class);
  }
  
  }
  </code></pre>