question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: App crashes while geolocation is disabled and user grants permission

See original GitHub issue

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)

  • Android
  • iOS
  • Electron
  • Web

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) 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, Jan 17, 2020

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 https://github.com/ionic-team/capacitor/issues/379

0reactions
ionitron-bot[bot]commented, Nov 12, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes on disabling location permission from settings
You are getting an error regarding location access permission denied by the user and you need to check the permission granted by using ......
Read more >
Geolocation disabled when Chrome is in the background or ...
The latest version of Chrome seems to turn off the GPS when either one of the following is true: (1) the screen is...
Read more >
App crashes when changing privacy settings - Apple Developer
I have an application recording audio in background, but when I go to settings and change some permissions like photos, the application crashes...
Read more >
Request location permissions - Android Developers
If the user grants the approximate location permission, your app only has access to approximate location, regardless of which location permissions your app...
Read more >
App is crashing or not working on Samsung phone or tablet
For the best results keep your phone updated to the latest software, and make sure your apps are updated. Check the app's permissions....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found