You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System:
OS: macOS 12.6.3
CPU: (10) arm64 Apple M1 Max
Memory: 108.56 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.14.2 - ~/.asdf/installs/nodejs/16.14.2/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 8.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.14.3 - /Users/mikeloos/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.14.1 - /Users/mikeloos/.asdf/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.5 => 0.67.5
react-native-macos: Not Found
npmGlobalPackages: react-native: Not Found
Platforms
Android
Versions
Please add the used versions/branches
Android: 12
react-native-geolocation-service: 5.3.1
react-native: 0.67.5
react: 17.0.2
Description
When I call geoLocation.watchPosition on Android, the app will crash with the error:
Could not invoke RNFusedLocation.startObserving
See below:
I've been able to reproduce the issue on the Android emulator but I first detected it when I got a Sentry log from a production user that was experiencing the same crash.
Here are some screenshots from the stack trace that Sentry captured:
No issues on iOS. The crash only occurs on Android. And, oddly enough, the issue appears to have just started occurring about 2 weeks ago. Before that, and for several months prior, the same code has been working without any problems.
Reproducible Demo
import Geolocation from 'react-native-geolocation-service';
const currentPositionOptions = { enableHighAccuracy: true, timeout: 20000, maximumAge: 0 };
const watchOptions = {
...currentPositionOptions,
maximumAge: 1000,
distanceFilter: 1,
};
const onNewPosition = (position: GeoPosition) => {
// save the position in redux
};
const onError = (functionName: string) => (error: GeoError) => {
// write an error message to logging service
};
const newWatchId = Geolocation.watchPosition(
onNewPosition,
onError('watchPosition'),
watchOptions,
);
Expected Results
Not crash
The text was updated successfully, but these errors were encountered:
Ok, I did some investigation myself and it appears that this is a known issue with recent updates to Google Play services. See the link below for more details:
Fortunately, there was a fix made last year in version 21.0.1 of the play-services-location library. To leverage this fix, I added the following line in my android > build.gradle:
buildscript {
ext {
....
playServicesLocationVersion = "21.0.1". <----- ADD THIS LINE
}
Once I made this change and rebuilt the app, the crash went away.
@Agontuk – To avoid this issue for others, you might consider changing the default version for react-native-geolocation-service and kick out a new version.
Environment
System:
OS: macOS 12.6.3
CPU: (10) arm64 Apple M1 Max
Memory: 108.56 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.14.2 - ~/.asdf/installs/nodejs/16.14.2/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 8.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.14.3 - /Users/mikeloos/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.14.1 - /Users/mikeloos/.asdf/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.5 => 0.67.5
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Platforms
Android
Versions
Please add the used versions/branches
Description
When I call geoLocation.watchPosition on Android, the app will crash with the error:
Could not invoke RNFusedLocation.startObserving
See below:
I've been able to reproduce the issue on the Android emulator but I first detected it when I got a Sentry log from a production user that was experiencing the same crash.
Here are some screenshots from the stack trace that Sentry captured:
No issues on iOS. The crash only occurs on Android. And, oddly enough, the issue appears to have just started occurring about 2 weeks ago. Before that, and for several months prior, the same code has been working without any problems.
Reproducible Demo
Expected Results
Not crash
The text was updated successfully, but these errors were encountered: