IOS foreground mode not update location as realtime as in android
See original GitHub issueIn IOS, I have to wait longer than expect to get location from callback function. As in android device, I got the location similar to HTML5.geolocation.watchPosition.
Your Environment
- Plugin version: 2.1.2
- Platform: iOS
- Device manufacturer and model:
- Cordova version (
cordova -v
): 6.1.1 - Cordova platform version (
cordova platform ls
): ios 4.1.1 - Plugin configuration options:
[
desiredAccuracy: 0,
stationaryRadius: 5,
distanceFilter: 1,
activityType: 'AutomotiveNavigation',
// debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
// stopOnTerminate: false, // <-- enable this
locationProvider: backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER,
interval: 3000, // <!-- poll for position every minute
fastestInterval: 500,
]
Expected Behavior
In foreground mode, I think we should able to get location as soon as possible like android did. In ios, the location will be callback around 20 sec.
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Location.startLocationUpdatesAsync - no realtime updates on ...
Summary of Issue. Using Location. startLocationUpdatesAsync with foregroundService gets much less updates than when the app is opened and in foreground.
Read more >Handling location updates in the background - Apple Developer
Configure your app to receive location updates when it isn't running in the foreground.
Read more >How do I get a background location update every n minutes in ...
Go to Project -> Capabilities -> Background Modes -> select Location updates. Go to Project -> Info -> add a key NSLocationAlwaysUsageDescription with...
Read more >Location updates in Android 11
If you request a foreground location permission and the background location permission at the same time, the system ignores the request and doesn't...
Read more >Track Users Location in the Background with Android and ...
Learn how to track a users or device location in the background on Android. Using Xamarin.Forms and Essentials, we will see how to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI, Since I couldn’t quickly figure out how to natively improve the accuracy I found a work around that kind of works for my app. As per your suggestion I used the HTML 5 geolocation feature, which works well for real-time updates, but it doesn’t run in the background by itself. I found out that with the “cordova-plugin-background-geolocation” installed and configured, for some reason, it allows me to run the HTML5 geolocation code in the background. I only had to configure the plugin then call
start
andstop
onsuccess, just once. The only disadvantage now is that every time I use the app the HTML5 geolocation feature asks for GPS permission. For some reason the WebView doesn’t remember the user’s decision. For my use-case that’s not a big issue though.yeah it should work better with option disableElasticity which basically turns off distanceFilter. Anyway as there is more and more people asking for this kind of behaviour, I’m thinking about creating bare version to suit your needs.