title: Wake up the screen if device detects the shake event
body: <p>I'm registering the sensor after the screen sleeps.I have to wake up the screen if device detects the shake event.
  If i connect the device with the system, device wakes up correctly.
  if i disconnect the device, 
  moto g device, chroma tablet  doesn't wake up. But samsung device wakes up.</p>
  
  <p>So that I have tested by displaying the logcat value in textview.
  I found the following problems:
  Sometimes after screen off, i didn't receive the broadcast message.
  Sometimes i receive the message, but maccel values didn't increase after shaking the device also.</p>
  
  <p>I'm using the following code:</p>
  
  <p><strong>For initialising sensor manager:</strong></p>
  
  <pre><code>manager=(SensorManager) getSystemService(Context.SENSOR_SERVICE);
  sensor=manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
  </code></pre>
  
  <p><strong>Registering Broadcast receiver:</strong></p>
  
  <pre><code>registerReceiver(screenoffreceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
  </code></pre>
  
  <p><strong>Broadcast receiver :</strong></p>
  
  <pre><code>private BroadcastReceiver screenoffreceiver = new BroadcastReceiver() {
          public void onReceive(Context context, Intent intent) {
              // TODO Auto-generated method stub
              Bundle extras = intent.getExtras();
              if (Intent.ACTION_SCREEN_OFF.equalsIgnoreCase(intent.getAction())) {
                  //screen has been switched off!
                  manager.registerListener(Testing.this, manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
  
              }
          }
      };
  </code></pre>
  
  <p><strong>For Detecting shake event:</strong></p>
  
  <pre><code>public void onSensorChanged(SensorEvent event) {
            float x = event.values[0];
            float y = event.values[1];
            float z = event.values[2];
            mAccelLast = mAccelCurrent;
            mAccelCurrent = (float) Math.sqrt((double) (x*x + y*y + z*z));
            float delta = mAccelCurrent - mAccelLast;
            mAccel = mAccel * 0.9f + delta; // perform low-cut filter
            Log.i("mAccel", "mAccel "+mAccel);
  
            mytext.setText(mytext.getText().toString()+" "+mAccel);
  
              if(mAccel&gt;=1) {
                  unlock_screen();
              }
  </code></pre>
  
  <p>Please help me to resolve these issues.</p>