I got an android demo named BasicManagedProfile which implements some new features about device policy manager.
Now I have a question about how to get the other package names when application in managed profile. For example, the demo shows the chrome and calculators name string to make presentations.
/**
* Package name of calculator
*/
private static final String PACKAGE_NAME_CALCULATOR = "com.android.calculator2";
/**
* Package name of Chrome
*/
private static final String PACKAGE_NAME_CHROME = "com.android.chrome";
But I want to know how to get others like dialer and contact.
I tried to use getInstalledPackages()
or queryIntentActivities()
but failed.
By the way, I use the method addCrossProfileIntentFilter()
like this:
IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN); filter.addCategory(Intent.CATEGORY_LAUNCHER);
MyActivity.deviceManager.addCrossProfileIntentFilter(MyReceiver.getComponentName(context), filter, FLAG_MANAGED_CAN_ACCESS_PARENT | FLAG_PARENT_CAN_ACCESS_MANAGED);
But the queryIntentActivities()
can not return the right list of applications.
Please give me some suggestion about these.