Reputation: 607
How to continue download task even when after the device is locked (pressing the power button). I tried installing an app from the play store, and during its download i locked the device, but it still continues to download without any interruption and is visible on the lockscreen as shown in the screen shot below. How do we achieve this programmatically?
Upvotes: 3
Views: 12423
Reputation: 76799
The example screenshot is misleading, since this is the Google Play Store.
Otherwise, one has to initiate the tranfers by DownloadManager
.
Upvotes: 0
Reputation: 2028
If you want a task to continue running, even when your Activity is not active, you need to use a Service
. https://developer.android.com/guide/components/services.html. The Play Store is probably using a Service to keep the download running in the background, and a Notification to show the status on the lock screen. https://developer.android.com/guide/topics/ui/notifiers/notifications.html
Upvotes: 0