Closed chrisbiscuit closed 2 days ago
Android has Config.triggerActivities but I don’t think I implemented for iOS. I’ll investigate.
Thanks for the response!
We had already looked at Config.triggerActivities
for Android, but we definitely need something similar for iOS as well.
Here’s a quick example of how we're using it on Android:
BackgroundGeolocation.ready({
triggerActivities: 'on_foot, running',
});
We'd really appreciate any updates on whether this can be extended to iOS or if there's another iOS-specific approach we could use.
Thanks again.
Please try installing version 4.17.3-rc.1
with iOS implementation for Config.triggerActivities
.
Thanks so much for adding the iOS implementation for Config.triggerActivities
. I really appreciate the quick turnaround on this.
I meant to post my original message on the capacitor-background-geolocation
repo, not the react-native-background-geolocation
one. Apologies for the mix-up!
Would you like me to raise a ticket on the correct GitHub repo (capacitor-background-geolocation
), or is it fine to leave it here? Just let me know what works best for you.
It’s crucial that you seek support at the appropriate repo for the product you’re using.
I manage this plug-in for 4 different development frameworks, not just the one you happen to be using.
Hi,
I’m developing a walking app where I would like to ignore location tracking when users are in vehicles or on bicycles. The goal is to only record locations when the user starts walking or running. I've been exploring the
onActivityChange
event and different configurations to achieve this.What I'm Trying to Achieve:
in_vehicle
andon_bicycle
activity types to prevent recording locations while the user is driving or cycling.on_foot
or other relevant activity types like walking or running.Approach I've Considered:
Using
onActivityChange
to Start and Stop Tracking: I was thinking of listening to theonActivityChange
event and starting/stopping location tracking based on the activity type. Here’s what I’ve considered so far:However, I'm concerned that stopping BackgroundGeolocation when the user is in a vehicle may cause the system to stop listening for future activity changes, preventing tracking from restarting when the user starts walking again.
Pausing Location Updates Instead of Stopping: Another approach I considered is using
changePace(false)
to pause tracking rather than completely stopping it, but only when the user is in a vehicle. Then, I'd resume tracking withchangePace(true)
once they are on foot again.My concern here is that if
changePace(false)
is set, it might not aggressively restart location tracking until a significant time has passed or the activity changes to something likewalking
.My Questions:
in_vehicle
)?onActivityChange
recommended?I’d appreciate any guidance or alternative suggestions on how to efficiently implement this.
Thanks!