-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation: CompassError code 3 on Android 10 #63
Comments
Error code 3 means the android device doesn't have a sensor available to use:
Despite of the suppress deprecation, the method doesn't appear to be deprecated: https://developer.android.com/reference/android/hardware/SensorManager#getSensorList(int) So this suggest that your device doesn't have an Orientation sensor. The constant is deprecated however, so perhaps you can try replacing it with |
Thanks a lot for the clarification @breautek. I didn't realise my phone doesn't have the sensor, which really is the case. So everything's ok then. I would only suggest documenting |
We can leave this ticket as a reminder to improve documentation |
I am experiencing the same issue using an "SM A125U1" phone (Android 12). Would it be possible for the plugin to throw CompassError.COMPASS_NOT_SUPPORTED when this happens? |
Hello, I am experiencing the same issue with a Xiaomi Redmi Note 11. When I go to the Google Maps App, the compass indication works fine and smoothly. So I don't suppose this is about the sensor … maybe a permission or something else? In my Ionic app, when I try to watch the headings, I get this error code 3. Kind regards, |
Hello, No news about the previous message ⬆️ ? Someone could help me with this? Thanks, |
Error code 3 is returned if the compass sensor could not start, which is the case if the sensor could not be found. This is likely because the sensor (TYPE_ORIENTATION) is deprecated and has been deprecated for some time now and replaced with a non-sensor There is no open PR that makes this change, but there is #78 which attempts to simulate orientation sensor by fusing two different sensors together. I'm not sure if I agree with this approach, but you could test it to see if it solves your problem. |
Hello @breautek, Thank you for your reply :) I tried to replace the file I see a little difference because I don't get an error that don't return the event callback data BUT, now, the event is returned but with incomplete values:
Do you have an idea why? Kind regards, |
Bug Report
Problem
When subscribing to a
watchHeading
function, I get aCompassError {code: 3}
response. It works on older Android phones. I haven't tested iOS. If I browsed the code correctly. The error code is neither one ofCompassError.COMPASS_INTERNAL_ERR CompassError.COMPASS_NOT_SUPPORTED
.What is expected to happen?
It should work.
What does actually happen?
I get an undocumented
CompassError
.Information
It doesn't work on Android 10.
Command or Code
Environment, Platform, Device
I used Angular 11, Ionic framework 5 and Capacitor.
Version information
ionic info
output:Checklist
The text was updated successfully, but these errors were encountered: