title: Simulate Android killing and restart service
body: <p>I want to simulate android killing and restarting my service to test what happens when I receive a null intent and what I need to do with cleanup / recovery.  Is this possible?</p>
  
  <pre><code>public MyService extends Service {
    @Override
    public void onCreate() {
      //Do stuff
    }
  
    @Override
    public void onStartCommand(Intent intent, int flags, int startId) {
      if (intent == null) {
        //Do stuff for restart
      } else {
        //Do stuff for normal start
        return START_STICKY;
      }
    }
  
  
    @Override
    public void onDestroy() {
      //Cleanup that may never be called!
    }
  }
  </code></pre>
  
  <p><em>Note: I read <a href="https://stackoverflow.com/questions/11365301/how-to-simulate-android-killing-my-process">how-to-simulate-android-killing-my-process</a>. The answers are very useful! But I think my use case is a bit different.</em></p>