Forums Register Login

Android custom broadcast receiver permissions

+Pie Number of slices to send: Send
In view of the security model in Android, I'm trying out custom permissions.
I'm trying out to enforce broadcaster permissions in my application. The scenario is that I have an activity A, which triggers a broadcasts like this (with a permission) :



In this activity A, I register a receiver in onCreate like this :



The receiver is defined as a private variable in the activity A as :


I expect the receiver to receive the broadcast as it has the required permissions that it needs. But it doesn't receive the broadcast sent out by the activity. There could be arguments on why I'm not using LocalBroadcastManager, but my motive is to figure out why this method isn't working as expected.

I have not declared my receiver in manifest and registering it dynamically only. All the above code is from a single activity within the same application. So there's no IPC involved here, just a simple example to check out the permissions. Any help would be appreciated.
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2618 times.
Similar Threads
Problem in starting activity from broadcast receivers
Are There a way to know if the internet(not network) disconnected
How to send SMS from emulator to phone?
How to retrieve string from EditText?
Application not run in the background
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:31:41.