Skip to content Skip to sidebar Skip to footer

Make My Android App Work Even If The User Navigates Away From It. How Do I Do That?

My Android application does some calculations, but I noticed recently that if I were to navigate away from the application, the thread that was running and doing the work stops. Th

Solution 1:

Your Activity will be paused when the device's screen turns off (and resumed when the screen turns on).

Consider doing your work in a Service instead. IntentService is one relatively easy way to do this because it takes care of creating a separate thread, processing your work requests one at a time, and cleaning up when there is no more work to be done.

Solution 2:

What are you are asking for is commonly called "running in the background." One way of doing this is services (tutorial here).

Post a Comment for "Make My Android App Work Even If The User Navigates Away From It. How Do I Do That?"