Closed stalteri closed 3 weeks ago
Show me the code that reproduces this.
also have this error in xcode:
Thread 1: "Error when sending event: location with body: {\n activity = {\n confidence = 100;\n type = unknown;\n };\n age = 565;\n battery = {\n \"is_charging\" = 0;\n level = \"-1\";\n };\n coords = {\n accuracy = 10;\n altitude = 0;\n \"altitude_accuracy\" = \"-1\";\n \"ellipsoidal_altitude\" = 0;\n floor = 0;\n heading = \"162.2\";\n \"heading_accuracy\" = 0;\n latitude = \"37.33097983\";\n longitude = \"-122.03063943\";\n speed = \"3.73\";\n \"speed_accuracy\" = 0;\n };\n extras = {\n };\n \"is_moving\" = 1;\n mock = 1;\n odometer = \"2047.4\";\n timestamp = \"2024-10-25T13:41:32.171Z\";\n uuid = \"0AE89EDA-3A27-4B6D-A092-F675912E06F7\";\n}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNBackgroundGeolocation, even though it's inherited from RCTEventEmitter."
Show me the code that reproduces this.
Also, why are you using .watchPosition()
? It's not required.
I use .watchPosition()
because I need to continuously send location with socket
here are ready and watch functions:
The plug-in already “continuously sends location” automatically when the device is detected to be moving. You only need to call .start().
if you want periodic locations, you’re free to use your own timer and call .getCurrentPosition.
.watchPosition is meant only for use in the foreground, for short periods of time.
it is not required by the plug-in’s core “Philosophy of Operation”.
OK, I'll try to use getCurrentPosition, after weekends
getCurrentPosition work without crashes 🔥 but I get continuous warning - Sending location with no listeners registered if I set empty listener [BackgroundGeolocation.onLocation(() => {})] its gone, but what if I dont need that listener at all? (because I'am using getCurrentPosition only)
but I get continuous warning - Sending location with no listeners registered
You don’t need to worry about that.
if you want that harmless warning to go away, add an empty .onLocation listener — it doesn’t cost anything.
OK, thanks
Your Environment
react-native -v
): 75.4Expected Behavior
no crash
Actual Behavior
IOS crash on reload while watchPosition, reproduced on simulator, did not try on a real device, crashing when reload app (metro server)
Steps to Reproduce
Debug logs
Logs
[crash-report.txt](https://github.com/user-attachments/files/17519085/crash-report.txt)