问题
I'm trying to add persisted activity to intent filter, I am profile owner and device owner and this is verified and I have no security exception but still my activity is not interrupting the call, not sure what to do next ...help please
ComponentName adminComponent = new ComponentName(getApplicationContext(), EnforcerDeviceAdminReceiver.class);
ComponentName handlerComponent = new ComponentName(getApplicationContext(), HandlerActivity.class);
devicePolicyManager.clearPackagePersistentPreferredActivities(adminComponent, getPackageName());
IntentFilter intentFilter = new IntentFilter(INTENT_ACTION);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
devicePolicyManager.addPersistentPreferredActivity(adminComponent, intentFilter, handlerComponent);
After adding this I am launching startActivity(new Intent(INTENT_ACTION));
from another application but this is not interrupted by the above activity.
回答1:
I've tried several things without being able to make it works.
However, the source code seems to do what the documentation say, so I guess the feature is currently broken (Android 5.0).
来源:https://stackoverflow.com/questions/28504495/addpersistentpreferredactivity-on-api21