Q: Android - Receiving broadcast from Download Manager when the app is killed I am building an Android app which can be used to download videos from a list of videos and watch them offline. I am using download manager to queue the downloads. The app uses a broadcast receiver to find if a download has completed.
I am maintaining a list of the downloads in my app. This list is serialized to disk whenever the queue is updated and deserialized when the app is started. 
However, if the app is killed before a download completes, it would not be able to receive the broadcast and the queue would not be updated.
What is the best way to resolve this? If it's a service then what kind of service? 

A: Before the download 
// Acquire partial wake lock to ensure that the CPU is running.
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.FETCHER_TAG);
mWakeLock.acquire();

and after you finish either with failure or success 
if (mWakeLock != null && mWakeLock.isHeld()) mWakeLock.release();
    mWakeLock = null;

