Permission denial on BroadCast SMS intent
-
26-09-2019 - |
Question
can my activity broadcast this intent from itself
Intent i = new Intent("android.provider.Telephony.SMS_RECEIVED");
sendBroadcast(i);
I am able to send this broadcast and receive it back (from a broadcast receiver setup in the application) , but this is not a global broadcast , i.e. it is not received by the default SMS application. furthermore i am getting this error in the logcat
Permission Denial: broadcasting Intent { act=android.provider.Telephony.SMS_RECEIVED } from com.smartanuj.scale (pid=3572, uid=10029) requires android.permission.BROADCAST_SMS due to receiver com.android.mms/com.android.mms.transaction.PrivilegedSmsReceiver
I have already specified
<uses-permission> android:name="android.permission.BROADCAST_SMS"></uses-permission>
in my manifest file
Solution
Only applications signed with the system key may broadcast the arrival of new SMS messages.
OTHER TIPS
You only need to have the BROADCAST_SMS privilege, and to generate the PDU by yourself. Then it works. You can find a summary here: http://blog.dev001.net/post/14085892020/android-generate-incoming-sms-from-within-your-app (second part, "Doing it by generating a SMS_RECEIVED broadcast").