What is the difference between sendbroadcast(), sendorderedbroadcast(), sendstickybroadcast() ?

Answer:
sendbroadcast() - normal broadcast, but we can set priority as well.
sendorderedbroadcast() - we can set priority, and set result. can block broadcasts as well.
sendstickybroadcast() - intent passed with this will be stick for future users

Description:
sendbroadcast() - normal broadcast, but we can set priority as well.

sendorderedbroadcast() - we can set priority, and set result. can block broadcasts as well.
In the ordered broadcast you can predict the order of broadcast receiver using priority in the intent_ Filter.
1.If the priority is same for two receivers then order cannot be predicted.
2.In the ordered broadcast you can also pass data between two receivers.
3.You can also abort the broadcast anywhere in between the receivers.

sendstickybroadcast() - intent passed with this will be stick for future users who are registering through code (dynamic receivers).
When somebody sends a sticky broadcast using send stickyBroadcast(in); then that broadcast will be available for the future users who are using dynamic receivers.
This broadcast will be available for only Dynamic Broadcast rx who are coming in future.

Eg for stickybroadcast is - BATTERY LOW.



2 comments:

  1. It prompts a discussion on variations, contrasts, or distinctions, Camera Apps Security aiming to clarify and enhance understanding about the specific subjects or concepts being compared.

    ReplyDelete