You can use the Cordova onPause and onResume
events to achieve your first task (refresh data on app resume). If you need to check the length of time that has passed while the app was suspended, you can get the time in milliseconds on pause and then get it on resume and compare the two values to determine what period of time has passed.
As for refreshing the DataSource on a 10 seconds interval, this sounds a bit too often, as it would cause flashing of the data and the users may not be able to view the data effectively. You can either use a longer period of time (note that setInterval
is more appropriate than setTimeout for repeating actions), or give up automatic updates and let the user trigger updates when they want them:
Pull to refresh