code: @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    @Override
    public void onTaskRemoved(Intent rootIntent) {
      LOGGER.d("try to restart service on task Removed");
  
      if (isAutoWakeUp) {
        Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass());
        restartServiceIntent.setPackage(getPackageName());
  
        PendingIntent restartServicePendingIntent =
            PendingIntent.getService(getApplicationContext(), 1, restartServiceIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarmService =
            (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
        alarmService.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 500,
            restartServicePendingIntent);
      }
  
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        super.onTaskRemoved(rootIntent);
      }
    }
docs: /*
  https://groups.google.com/forum/#!topic/android-developers/H-DSQ4-tiac
  @see android.app.Service#onTaskRemoved(android.content.Intent)