michael
michael

Reputation: 110550

In my broadcast receiver 's onreceive() method, how can I tell the origin of the Intent

In the broadcast receiver's onReceive() method, how can I tell which app send me the Intent?

Upvotes: 1

Views: 457

Answers (1)

Nick Campion
Nick Campion

Reputation: 10479

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.

Upvotes: 3

Related Questions