I am trying IO operation in IntentService at onHandleIntent method but it is not guarantee to call every time and many times skip network call.
Can anyway handle network call in background ?
z
z0rawar
08/31/2017, 11:19 AM
Can you elaborate more about the problem with your onHandleIntent?
In case you would like to make network calls in background and not have them skipped, you can use the new JobScheduler in API 21 which queues your jobs and handles network not available/exponential backoff etc for free. If your minSdk is <21 you can check https://github.com/evernote/android-job
q
quock
08/31/2017, 11:33 AM
Actually I put retrofit network asynchronous in IntentService for network communication but many times they skip and not have guaranteed callback.
d
david.bilik
08/31/2017, 11:51 AM
you cannot have async callback in intent service .. your service is finished when onHandleIntent finishes so you have no guarantee that its alive when your callback should be called
q
quock
08/31/2017, 12:04 PM
Make sense and as per @z0rawar suggested me to use Android Job as alternative to get success callback. I think so this would be best option.