English subtitles

← Broadcast Intents - Developing Android Apps

Get Embed Code
10 Languages

Showing Revision 15 created 05/24/2016 by Udacity Robot.

  1. We've talked about using
    intents within Sunshine
  2. to start activities
    and send data between apps.
  3. But what if you want to broadcast
    a message to many apps?
  4. For example, the system will broadcast
    a message, saying that
  5. the device is charging
    or that it's just finished rebooting.
  6. To do that ourselves,
    we use the SendBroadcast method
  7. to broadcast an intent.
    And those broadcasts are recieved
  8. by broadcast receivers, typically referred
    to as, simply, receivers.
  9. Using intent filters,
    like the ones we saw earlier,
  10. they indicate which broadcast
    they're interested in.
  11. So if we return to our envelope
    metaphor from earlier,
  12. in the case of a broadcast intent,
    your envelope is basically addressed
  13. to any broadcast receiver
    that's interested in knowing
  14. that this event has happened.
    And it does that using intent filter.
  15. So intents, which are broadcast,
    are transmitted to every app
  16. with a broadcast receiver
    that has an intent filter
  17. telling the system
    your ideas are intriguing
  18. to me and I wish
    to subscribe to your newsletter.