After doing some research on what is the best way to run a background task from an Android Activity in a way that it persists throughout all the Activity changes (e.g. rotations) I've come up with two possible solutions, yet still have not decided which one is the best.
The solution you first find is by using IntentService, that way the process is run in a segregated thread and does not mess with the main ui thread.
The other solution to persist the task is to run it in a Fragment class without a graphic interface.
I'm looking forward to being able to handle any type of Object as a result of the background task. I've read that the IntentService can only handle intents in that way and all the objects that takes need to be Serializable/Parcelable. So that is kind of a limitation IMHO.
0 comments:
Post a Comment