title: Unregistering SensorManager doesn't work
body: <p>In my app, I am using the light and proximity sensor to detect phone out of pocket functionality and then unregistering the SensorManager when their detection is complete. But even when the CPU usage by the app shows just 1-2 sec usage, the battery usage always shows my app as no. 1 app in the list which is worrying.</p>
  
  <p>I have used the SensorManager.unRegisterListener and also set SensorManager = null, but the situation remains the same.</p>
  
  <p>I have read, that due to some bug, the sensors are not unregistered correctly. Any good way to dispose the sensors correctly ?</p>
  
  <p>Pls guide.
  Omkar Ghaisas</p>
  
  <p>Updated with Code sample from app -</p>
  
  <pre><code>@Override
  protected void onPause()
  {
      super.onPause();
      unHookReceiver();
  }
  
  private void unHookReceiver()
  {
      if (r != null)
      {
          unregisterReceiver(r);
          if(GetProximityPreference("EnableReceiveByProximity"))
          {
              mySensorManager.unregisterListener(proximitySensorEventListener);
              mySensorManager.unregisterListener(lightSensorEventListener);
              mySensorManager = null;
              FileUtils.appendLog(FileUtils.GetCurrentDateTime() + " Power Consumption Log End");
              FileUtils.appendLog("------------------------------------------------");
          }
          r = null;
      }
  }
  </code></pre>
  
  <p>I am also setting the sensorManager = null as per one suggestion from one post on stackpverflow, but even that doesn't help. In spite of calling the cleanup code, the battery usage is still very high. The app by itself should not be using much battery as its a very simple app with just one broadcast receiver and one activity, but within the activity, I invoke the Light and Proximity sensors and I doubt those are causing the spike in battery usage. Not sure why though.</p>
  
  <p>Any help is highly appreciable.</p>