I want to start the BroadcastReceiver of other application installed on my android device from my app. Here is the code
ComponentName componentName = new ComponentName("com.example.myapp","com.example.myapp.MyBroadcastReceiver");
pkgManager.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
"com.example.myapp" is the package name of the other application which contains "MyBroadcastReceiver"
I referred answers given in the post Android PackageManager enable any application and Android - can't enable BroadcastReceiver but none of them seems to be working. The application continues throwing the permission denial SecurityException. Given is the logcat
05-24 11:37:38.382: E/AndroidRuntime(8746): java.lang.SecurityException: Permission Denial: attempt to change component state from pid=8746, uid=10042, package uid=10041