In the broadcast receiver's onReceive() method, how can I tell which app send me the Intent?
Asked
Active
Viewed 382 times
1
-
1Is it not the idea that you would not know unless it is put into the intent? – Aliostad Jan 18 '11 at 23:00
-
I am doing something similar HERE!!! http://stackoverflow.com/questions/14571564/android-pendingintent-extras-not-received-by-broadcastreceiver/14612215#14612215 – Etienne Lawlor Jan 31 '13 at 07:52
1 Answers
3
This is not the intent of how android uses Intents (no pun intended.). However, if you are sending the intent and your broadcaster is receiving the intent, you can use setExtra ( String, String) on the Intent to attach the name of the class sending the intent. Inside your onReceive, check to see if that extra is set and, if it is, check to see if the value matches your expected class.

Nick Campion
- 10,479
- 3
- 44
- 58