GPS tracking in the Background

Young Calabria 61 Reputation points
2021-06-30T01:40:55.21+00:00

I'm trying to build an app that track gps location in the background so it does a specific job when getting nearby.
What I've found is that such apps are no more available for ios > v.13 and android > v.8.
Correct me please if I'm wrong.

How for example Google Maps are still getting my gps location in the background?
If so, how can I achieve that?

Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,349 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 31,166 Reputation points Microsoft Vendor
    2021-06-30T09:50:21.347+00:00

    Hello,
    Welcome to our Microsoft Q&A platform!

    I'm not clear about how your app does it. If you want to track gps location in the background, in iOS, you need to add key “NSLocationAlwaysUsageDescription” in infor.plist and choose “Location updates” in Background Modes . After android8, there are some behavior changes. You can register a Forground Service and use Notifications to let the location run in the background .
    For more information , you can refer :
    https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/ios-backgrounding-walkthroughs/location-walkthrough
    https://learn.microsoft.com/en-us/xamarin/android/platform/maps-and-location/location
    https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/services/foreground-services

    Best Regards,
    Wenyan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.