title: How to enable proximity sensor in android
body: <p>I have configured proximeter successfully in my code. Now I want to turn off &amp; on screen programmatically. Code of sensor is working just fine and following method is also getting called.</p>
  
  <pre><code>@Override
  public void onSensorChanged(SensorEvent event) {
      // TODO Auto-generated method stub
  
      PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
      WakeLock screenWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"screenWakeLock");
  
      if (event.values[0] == 0) {
          screenWakeLock.acquire();
          Log.e("onSensorChanged","NEAR");
      } else {
          if (screenWakeLock != null) {
                 if(screenWakeLock.isHeld())
                    screenWakeLock.release();
                 screenWakeLock = null;
          }
          Log.e("onSensorChanged","FAR");  
      }
  } 
  </code></pre>
  
  <p>My problem is that screen is not getting turn off. I also have added required permission in code. What else could be the reason ???</p>