Quanturium
Quanturium

Reputation: 5696

Swipe away my application from the recents activity kills my service

I created a service to handle my AsyncTasks like uploading a file on a server or downloading one. When I swipe away my app from the recent activity menu, my service is killed. Is it normal behaviour ? If so, one solution would be to set it as a foreground service with startForeground(int, Notification) but I must display a notification and I don't want it as I'm already displaying one for each AsyncTask running.

How does the "play store" app download applications and keep the downloads alive even if I swipe away the "play store" from the recent activity menu ?

Upvotes: 3

Views: 828

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

Is it normal behaviour ?

Yes. Android, at the user's request, terminated your background process.

If so, one solution would be to set it as a foreground service with startForeground(int, Notification) but I must display a notification and I don't want it as I'm already displaying one for each AsyncTask running.

Please do not show a separate Notification "for each AsyncTask running". At most, show one Notification. Few, if any, apps are important enough to warrant separate Notifications.

Upvotes: 2

Related Questions