Home > DeveloperSection > Interviews > Is there anyway to determine if an Intent passed into a BroadcastReceiver's onReceive is the result of a sticky Boradcast Intent, or if it was just sent?

Posted on    June-15-2015 12:45 AM

 Android Android  Android Intent 
 1 Answer(s)
  308  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    June-15-2015 12:45 AM

When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

Don't want to miss updates? Please click the below button!

Follow MindStick