Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Broadcast Receiver</strong></p> <p>Quoting <a href="https://android-developers.googleblog.com/2010/04/multitasking-android-way.html" rel="noreferrer">Dianne Hackborn on the Android Developers blog</a>:</p> <blockquote> <p>When handling a broadcast, the application is given a fixed set of time (currently 10 seconds) in which to do its work. If it doesn't complete in that time, the application is considered to be misbehaving, and its process immediately tossed into the background state to be killed for memory if needed.</p> </blockquote> <p>Broadcast receivers are limited by maximum amount of time(10 seconds generally), they have to finish.</p> <p><strong>Service</strong></p> <p>If your action takes some longer time (connecting to the internet can take some).More preferrably as the run at background. You definitely should call a service from the receiver or Activity for this purpose. They are last to be killed by android Operating System.</p> <p>Conclusion:</p> <ol> <li><p>Generally speaking all the work (fetching, parsing, caching, updating database) which is important to your application should be moved to <code>Service</code> as they are long lived on Android. As you've almost considered that all the social networking sites have there <code>STICKY_SERVICES</code> which does all troublesome work. </p></li> <li><p><code>BroadcastReceiver</code> are mostly used to start the service. It generally depends upon application. Most of the application uses <code>ConnectivityManager</code> to broadcast whenever network is UP OR DOWN. With the help of these <code>Service</code> are started by <code>BroadcastReceiver</code>.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload