I have a service in my Android Application which runs always.Now i have a settings from my server through GCM and update these settings to my service. I put my settings in o
or you can use a delayed handler to start the service. The handler will need to be declared static in a singleton, so its reference is not killed while restarting:
serviceRestartHandler = new Handler ();
serviceRestartHandler.postDelayed (new Runnable () {
@Override
public void run() {
startService (new Intent (mContext, YourWonderfulService.class)
.putExtra (flagName, true));
serviceRestartHandler.removeCallbacksAndMessages (null);
}
}, 1000);
stopSelf ();