code: @TargetApi(Build.VERSION_CODES.FROYO)
      public static boolean hasCompassSensorFeature(Context context) {
          return hasCompassSensorFeature(context.getPackageManager());
      }
docs: Checks if the device has a compass sensor.
  @param context the context.
  @return {@code true} if the device has a compass sensor.