public boolean getHasCompass() {
    boolean compass = false;

    SensorManager sensorManager = TiSensorHelper.getSensorManager();
    if (sensorManager != null) {
      compass = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION) != null;
    } else {
      compass =
          TiSensorHelper.hasDefaultSensor(geolocationModule.getActivity(), Sensor.TYPE_ORIENTATION);
    }

    return compass;
  }
  public void onSensorChanged(SensorEvent event) {
    if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
      long eventTimestamp = event.timestamp / 1000000;

      if (eventTimestamp - lastEventInUpdate > 250) {
        long actualTimestamp = baseTime.getTimeInMillis() + (eventTimestamp - sensorTimerStart);

        lastEventInUpdate = eventTimestamp;

        Object filter = geolocationModule.getProperty(TiC.PROPERTY_HEADING_FILTER);
        if (filter != null) {
          float headingFilter = TiConvert.toFloat(filter);

          if (Math.abs(event.values[0] - lastHeading) < headingFilter) {
            return;
          }

          lastHeading = event.values[0];
        }

        geolocationModule.fireEvent(TiC.EVENT_HEADING, eventToHashMap(event, actualTimestamp));
      }
    }
  }