I have to do a background process which will perform some operations.. while this operation is running, a user can switch from one activity to another. How can i do this by maintaining the background process to be keep running ? Please reply.
i was using asynctask for this. but when i switch from one activity to another it use to stop the operations which were getting performed at background thread. Please reply
I have to do a background process which will perform some operations.. while this
Share
If you want to perform a background task that should run to completion irrespective of which activity is brought to front, you can set up a service to achieve this. The Android system assigns a dedicated thread pool to your service which allows tasks executed via the service run independent of the foreground activity of your app.
The Android developer documentation provides a detailed description and overview of this concept.
I had a similar requirement with my app .. Using services did the trick for me 🙂