michalchudziak / react-native-geolocation

Geolocation APIs for React Native
MIT License
1.28k stars 220 forks source link

Can't get location when offline and switch location to off and on again #242

Open eduardobonetti opened 1 year ago

eduardobonetti commented 1 year ago

Environment

System: OS: macOS 12.6 CPU: (8) arm64 Apple M1 Pro Memory: 112.80 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 28, 29, 30, 31, 32 Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0 System Images: android-32 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: 11.0.14 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.68.0 => 0.68.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Platforms

Android and iOS

Versions

Description

Both on android and ios, if you are without internet connection it is possible to obtain the location, however, if you turn off the location service and then activate it again it is no longer possible to obtain a location

Reproducible Demo

  1. Turn off wifi and mobile data or turn on airplane mode (you will still be able to access location)
  2. Turn device location service off and on again
BraveEvidence commented 1 year ago

This will help https://www.youtube.com/watch?v=E7X9DjezSR0

renishdeveloper commented 6 months ago

I'm also facing the issue of getting the device location (latitude and longitude) in iOS, the handler waits till the time out set in the method and than it goes inside the catch block, what will be the possible solution?