Issue
I am thinking of adding a button in app settings that starts a task to update SQLite database with data from API endpoint for offline use.
This task could take 2-3 minutes and a big problem would be if it gets interrupted by changing activities, etc.
How should I approach this? Is there a way to prevent user from switching activities or should I just display a message that database is updating and show a progress bar?
Solution
There's never a way to stop the user from switching activities (although this should be done in a Service most likely). Even if you could, you can't stop them from pulling the battery. Always assume that a long running process could be killed asynchronously at any time, and program accordingly.
Answered By - Gabe Sechan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.