Open christocracy opened 8 months ago
@christocracy
Thank you for looking into this. Yes, it's an expo app.
npm install
)npx expo run:android
)a
to launch on the Android device.chris@studio:bgLocation $ npx expo run:android
› Skipping dev server
› Building app...
Error: spawn /Users/chris/workspace/background-geolocation/react/tmp/react-native-background-geolocation/bgLocation/android/gradlew EACCES
Error: spawn /Users/chris/workspace/background-geolocation/react/tmp/react-native-background-geolocation/bgLocation/android/gradlew EACCES
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
$ chmod +x ./android/gradlew
I have your app launched (I added debug: true
to .ready(config)
so I can hear the plugin).
I click [Activate]
. The plugin successfully starts, obtains the motionchange
location and enters the stationary state, as expected.
There is nothing unusual about your demo app.
I'm not sure if you understand the plugin's Philosophy of Operation, to only track location when the device is detected to be physically moving.
@christocracy Thank you again for looking into this.
I definitely have a good grasp of the philosophy of operation. I escalated the issue because when I setup and start a "Route" on the android emulator, the react-native-background-geolocation plugin is giving inconsistent results.
The device is supposed to be driving along the route that I specified, but the plugin just starts and immediately terminates. I found that if I reload the app (press r
in the npx expo run:android
console) that the app will sometimes start back up with the tracking working as expected and drop breadcrumbs consistently, but haven't been able to get it to work just by pressing Activate
yet.
I also found that if I do manage to get the app to drop breadcrumbs consistently that as soon as I press Deactivate
it stops working forever. Subsequent calls to Activate
don't start the tracking consistently again, the plugin just starts and immediately terminates again.
Per the Philosophy of Operation documentation, with my current configuration I should be receiving a location update every 5 seconds regardless of device motion or whether I've left the geofence.
BackgroundGeolocation.ready({
foregroundService: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
enableHeadless: true,
stopOnTerminate: false,
stopTimeout: 0,
distanceFilter: 0,
locationUpdateInterval: 5000, // Get a location every 5 seconds
disableStopDetection: true,
disableMotionActivityUpdates: true,
url: "http://192.168.1.200:19205/",
logLevel: BackgroundGeolocation.LOG_LEVEL_DEBUG,
notification: {
title: "Background tracking enabled",
text: "We are monitoring your location",
channelName: "check-in",
},
});
Hoping that provides a bit more insight to what I'm seeing.
You cannot fully experience the plug-in behaviour in the emulator. You need to go outside with real movement and a real device.
@christocracy does it really not work on the emulator? I'd think that if I have it setup without the motion tracking enabled and with the distanceFilter set to 0 that I'd get consistent location updates. We may not be able to use the plugin if we can't test it reliably in our dev environment.
The Emulator is well-known to fail at firing geofences.
Go outside and test with a real device.
I never test this plug-in with the emulator. It doesn't work.
What are the exact steps to setup and run this app after cloning this repo?
Is it an expo app?