I am trying to make a service in a separate process which should be restarted after manual stop in task manager. Return of START_STICKY in onStartCommand() doesn't work for me. Here is the code:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
Activity starts the service like this:
@Override
protected void onResume() {
doStartService();
super.onResume();
}
private void doStartService() {
Intent intent = new Intent(getApplicationContext(), MyService.class);
startService(intent);
doBindService();
}
private void doBindService() {
bindService(new Intent(this, MyService.class), mConnection, Context.BIND_AUTO_CREATE);
mBound = true;
}
What can be wrong?