Cordova Compass Api Is Giving Error Code 3
This question is already asked on stackoverflow here but I didn't found any answer to it, so I raised again this. Please can anyone able reply for this? My code is as follows: <
Solution 1:
Either your device does not have a magnetic sensor, or the vendor has not implemented support for it in the OS.
Looking at the Android source code for the device-orientation plugin, the startup code is written like this (modified for brevity):
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
// If found, then register as listenerif (list != null)
this.setStatus(CompassListener.STARTING);
// If error, then set status to errorelsethis.setStatus(CompassListener.ERROR_FAILED_TO_START);
Not sure why they made up their own error code there (public static int ERROR_FAILED_TO_START = 3
), but really they should be reporting COMPASS_NOT_SUPPORTED
as defined in the documentation.
Post a Comment for "Cordova Compass Api Is Giving Error Code 3"