Hi MyBroadband Developers,
I have been having a lot of fun re-building my 4th year Android application, adding all sorts of extras that I left out in 2017.
Currently, when communicating with my Web API, I use JobIntentService, which, from my understanding, allows the developer to run short tasks in the background. Once the job is done, I send a broadcast back to the activity/fragment that registered to receive the specified broadcast.
I realized this morning that there is a problem with the way I am going about communicating with my API - A user could "minimize" the app and do other things on their phone. onStop is called, which unregisters the receiver, then onResume is called when the user goes back into the app (this registers the receiver). This will create situations where a task executes, it completes its work, it sends a broadcast but the broadcast is not received because the user may have the app "minimized"
So my question to the MyBroadband Developers is, what would be the best way to run network related tasks on Android in such a way it prevents the situation I described in the previous paragraph?
I have been having a lot of fun re-building my 4th year Android application, adding all sorts of extras that I left out in 2017.
Currently, when communicating with my Web API, I use JobIntentService, which, from my understanding, allows the developer to run short tasks in the background. Once the job is done, I send a broadcast back to the activity/fragment that registered to receive the specified broadcast.
I realized this morning that there is a problem with the way I am going about communicating with my API - A user could "minimize" the app and do other things on their phone. onStop is called, which unregisters the receiver, then onResume is called when the user goes back into the app (this registers the receiver). This will create situations where a task executes, it completes its work, it sends a broadcast but the broadcast is not received because the user may have the app "minimized"
So my question to the MyBroadband Developers is, what would be the best way to run network related tasks on Android in such a way it prevents the situation I described in the previous paragraph?