Skip to content

Could not invoke RNFusedLocation.startObserving #431

Open
@Off2Race

Description

@Off2Race

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

  • 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:

Screenshot_1702584957

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:

Sentry-1 Sentry-2

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions