I have a plugin for my app that is started with a BroadCast. I already managed to add a custom permission, so only apps with the permission can receive the broadcast.
However, I have no idea how to achieve the more important part: How can I check, if the sender has a custom permission, so only my main app can send the broadcast?
I know this is possible, but I don't know how to do it.
Thanks!
Try using:
in your broadcast receiver. Or declare the permission in your AndroidManifest.xml where you define your receiver.
I've tried using checkCallingPermission from within an AppWidgetProvider and although I've added to the AndroidManifest.xml:
In my widget, result is -1 (PackageManager.PERMISSION_DENIED).
Clicking on the widget sends a PendingIntent to start a services which performs an AsyncTask, the postExecute of the AsyncTask sends the Intent I'm waiting for.
Thanks.