Skip to content Skip to sidebar Skip to footer

Android - Timer Not Running In Perodic Intervals When App Is In Locked Or Sleep State

In my android project I have periodic task to update API for every 60 seconds for that i am using TimerTask everything is working fine when app is in background or foreground when

Solution 1:

Since your requirement is to sync the data between app and server you can use the native feature of Android called SyncAdapter, this will sync the data either way based on a time interval. You can read about it here in the docs. I would suggest this approach instead of TimerTask.


Post a Comment for "Android - Timer Not Running In Perodic Intervals When App Is In Locked Or Sleep State"