title: calling getSystemService inside a service
body: <p>I'm trying to write a service that get the heart rate on Gear Live, following the question here <a href="https://stackoverflow.com/questions/24664217/get-heart-rate-from-sensor-samsung-gear-live">Get Heart Rate from &quot;Sensor&quot; Samsung Gear Live</a></p>
  
  <p>If I put this part </p>
  
  <pre><code>    Log.d(TAG, "prepare to call getSystemService");
      mSensorManager = ((SensorManager)getSystemService(SENSOR_SERVICE));
      Log.d(TAG, "after calling getSystemService");
  </code></pre>
  
  <p>at <code>onCreate()</code> of an activity, it works fine. But if I move that to a Service, it throws a NPE. I tried to add <code>this.</code> in front of `getSystemService, doesn't help. Any tip, thanks</p>