I want my push service to run after specific interval to push data to server at a duration of 1 hour.but it stops pushing data after 1 day, or sometimes when the app crashes though service is a seaparate process as it extends intent -service
public class PushService extends WakefulRepeatableService
{
public PushService() {
super("PushService");
}
@Override
protected void executeBackgroundService(Intent intent) throws Exception {
new SmsLoggerforService(this, dayBeforeYesterday, currentDate, false)
.start();
new CallLoggerforService(this, dayBeforeYesterday, currentDate, false)
.start();
postDataperHour();
}
@Override
protected long getRepeatingInterval() {
return INTERVAL_HOUR;
}
// We can move it to super class using reflection, if Proguard is not being used.
protected Intent getServiceIntent(Context context) {
return new Intent(context,
PushService.class);
}
}
referring to this tutorial https://randling.wordpress.com/2013/12/29/wakeful-and-repeatable-background-service-on-android/