Reputation:
I have a broadcastReceiver
registered in manifest that receives broadcasts sent from one of my services with a custom action. I have it already working but for security reasons i want to prevent other apps from sending fake broadcast to my receiver. How can i do that?
Manifest
<receiver android:name=".MyReceiver">
<intent-filter>
<action android:name="MyAction"/>
</intent-filter>
</receiver>
Upvotes: 3
Views: 1125
Reputation:
As another solution i found that i can use permissions
.
more on here
Upvotes: 0
Reputation: 329
Every reciever with exported
tag set to false
will only receive broadcasts sent from its own application process.
so it will be:
<receiver android:name=".MyReceiver"
android:exported="false">
<intent-filter>
<action android:name="MyAction"/>
</intent-filter>
</receiver>
Upvotes: 3