1

I am using addPersistentPreferredActivity() method of DevicePolicyManager but its not working.

I made Google Nexus 5.0 android device as device owner using dpm command and after that I used above method to make my application's activity as HomeActivity but its not working.

Below is the piece of code which I am using:

IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
filter.addCategory(Intent.CATEGORY_DEFAULT);
devicePolicyManager.addPersistentPreferredActivity(demoDeviceAdmin,filter,new ComponentName(getApplicationContext(),LauncherActivity.class));

Can anyone help me to sort out this issue?

user2478004
  • 101
  • 5

1 Answers1

0

Maybe you forgot to add this in your activity manifest:

<intent-filter>
     <category android:name="android.intent.category.HOME" />
     <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Moshe Yamini
  • 608
  • 9
  • 13