-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bug: App crashes while geolocation is disabled and user grants permission #2186
Comments
Same error here on Android as well, can we get a resolution on this asap. My boss is gonna fire me if I don't fix it! |
@FootDollarFiveLong I resolved this at the moment by requesting GPS permission on startup, before the map screen is loaded. |
Our application requests permission before any use with google maps. As soon as permission is accepted, it crashes instantly, the map isn't used until well after. I will try and call it at the very beginning to see if it helps. Fingers crossed! Edit: It did not work :( |
We are seeing the same in a PoC project we are working on. If location is disabled when the app is granted permission it crashes. This does not appear to happen on Android 9 but does on Android 10. |
I could reproduce on Android 10, works fine on Android 9 as hellokingdom said. In next major release we will move to fused location providers and will hopefully fix this problem #379 |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Bug Report
Capacitor Version
npx cap doctor
output:Latest Dependencies:
@capacitor/cli: 1.3.0
@capacitor/core: 1.3.0
@capacitor/android: 1.3.0
@capacitor/ios: 1.3.0
Installed Dependencies:
@capacitor/cli 1.3.0
@capacitor/core 1.3.0
@capacitor/ios 1.3.0
@capacitor/android 1.3.0
[success] Android looking great! 👌
Affected Platform(s)
Current Behavior
When device the GPS service is turned off
And perrmissions are granted
Then the application crashes
Expected Behavior
The application does not crash
Reproduction Steps
Call watchPosition or getCurrentPosition from the Geolocation plugin while the GPS service is turned off. After the user grants permission in the permission popup, the app will crash.
Other Information
Caused by: java.lang.IllegalArgumentException: invalid provider: null at android.location.LocationManager.checkProvider(LocationManager.java:2337) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:553) at com.getcapacitor.plugin.Geolocation.startWatch(Geolocation.java:97) at com.getcapacitor.plugin.Geolocation.handleRequestPermissionsResult(Geolocation.java:190) at com.getcapacitor.Bridge.onRequestPermissionsResult(Bridge.java:746) at com.getcapacitor.BridgeActivity.onRequestPermissionsResult(BridgeActivity.java:201) at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8264) at android.app.Activity.dispatchActivityResult(Activity.java:8114) at android.app.ActivityThread.deliverResults(ActivityThread.java:4838) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
The text was updated successfully, but these errors were encountered: