title: What exactly do Stopself()? What's the best way to terminate a service running?
body: <p>i'm a beginner in android and have not much experience on java...</p>
  
  <p>I have an Activity that creates an <code>ALARM MANAGER</code> and starts <code>alarmManager.setRepeating()</code> pointing to a Service.</p>
  
  <p>This Service in onCreate set a partial wakelock to perform the entire execution of the code (the app is made for non user interaction an so the phone is always in standby).</p>
  
  <p>All of this work perfect.</p>
  
  <p>Sometimes the Service should not perform entire code, but exit before from execution. So i have used  <code>StopSelf</code> but i have some doubts:</p>
  
  <ul>
  <li><p><code>onDestroy</code> function in Service has the code to delete the wakelock. Does <code>StopSelf()</code> call it?</p></li>
  <li><p>Anyway if i don't specify any function to terminate the service, after code execution when is it terminated?</p></li>
  </ul>
  
  <p>So in my case, is better replace <code>onDestroy()</code> instead of <code>Stopself()</code> ? 
  many thanx!</p>