code: public boolean start(SensorManager sensorManager) {
      // Already started?
      if (accelerometer != null) {
        return true;
      }
  
      accelerometer = sensorManager.getDefaultSensor(
          Sensor.TYPE_ACCELEROMETER);
  
      // If this phone has an accelerometer, listen to it.
      if (accelerometer != null) {
        this.sensorManager = sensorManager;
        sensorManager.registerListener(this, accelerometer,
            SensorManager.SENSOR_DELAY_FASTEST);
      }
      return accelerometer != null;
    }
docs: Starts listening for shakes on devices with appropriate hardware.
  
  @return true if the device supports shake detection.