Skip to content

Get accuracy of compass #4

@draperunner

Description

@draperunner

In order to check whether the user needs to recalibrate the compass or not, it would be nice to get some information about the accuracy of the measurements.

It seems likenewHeading.headingAccuracy on iOS and public void onAccuracyChanged(Sensor sensor, int accuracy) on Android are the ways to get the accuracy. This could for instance be sent as a second parameter in the event handler callback: RNSimpleCompass.start(degree_update_rate, (degree, accuracy) => { ...

A problem is that "accuracy" is not the same thing on iOS and Android... Android uses four integer values, while on iOS uses floating point values that might be negative.

An alternative to getting the accuracy value is to dispatch an event when the compass is giving an invalid value, and will probably need calibration. This is when the accuracy is negative on iOS or 0 on Android.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions