I am trying to send an intent from a non system app using the following function.
public static void sendIntent() {
if (null != _context) {
Intent intent = new Intent("com.test.testApp.testIntent");
intent.setPackage(_context.getPackageName());
_context.sendBroadcast(intent);
}
}
But I always see there is an error message from ActivityManager as below. The same intent broadcasting(app) works fine in andorid 6.0 but throws an error in android 7.1.1. I am required to change anything for android 7.1.1?
4-10 15:06:34.423 1615 2921 E ActivityManager: Sending non-protected broadcast com.test.testApp.testIntent from system 2886:com.test.testApp/u0a117 pkg com.test.testApp
In a ListFragment I register the receiver as follows:
@Override
public void onStart() {
super.onStart();
getActivity().registerReceiver((receiver),
new IntentFilter(com.test.testApp.testIntent));
TextView textDownload = (TextView) getActivity().findViewById(R.id.output);
textDownload.setVisibility(android.view.View.INVISIBLE);
}
This might help,
If you have in your AndroidManifest.xml declared "android:sharedUserId="android.uid.system", then declare the protected broadcast.
Reference : https://stackoverflow.com/a/50240471
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With