Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could as well send an <code>Intent</code> from the <code>RestService</code> directly to the <code>DownloadService</code> without putting the <code>BroadcastReceiver</code> between the two of them. </p> <p>I think <a href="http://developer.android.com/reference/android/app/IntentService.html" rel="nofollow"><code>IntentService</code></a> will be a better aproach for your <code>DownloadService</code>.</p> <blockquote> <p>IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.</p> <p>This "work queue processor" pattern is commonly used to offload tasks from an application's main thread. The IntentService class exists to simplify this pattern and take care of the mechanics. To use it, extend IntentService and implement onHandleIntent(Intent). IntentService will receive the Intents, launch a worker thread, and stop the service as appropriate.</p> <p>All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.</p> </blockquote> <p><b>EDIT:</b> forgot to mention that since <code>API Level 9</code> Android has a <a href="http://developer.android.com/reference/android/app/DownloadManager.html" rel="nofollow"><code>DownloadManager</code></a> class that handles your downloads, retries them after failures, connectivity changes, etc.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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