<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Tracking location in the background while .NET MAUI app is suspended or screen is off in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568957#M13177</link>
    <description>&lt;P&gt;Unfortunately the Android platform makes implementing the scenario a lot harder and has to be done at the application level with the foreground service. There's not much we can really do at the API level, besides improving our documentation to help implement this.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2024 17:07:26 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2024-12-16T17:07:26Z</dc:date>
    <item>
      <title>Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565247#M13162</link>
      <description>&lt;P&gt;This may not exactly be a question about the Maps SDK for .NET, but given that it's a .NET MAUI app that uses the SDK and location services, I thought I'd probe the mobile dev community for advice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a .NET MAUI app with a map page that I'm using to track the location of the user on a map. It basically shows the breadcrumb path the user has taken on their hike with a dashboard showing their distance, timer and average speed. It works exactly as it should when the screen is turned on and the app is on the foreground: path updates when location is changed and dashboard metrics change as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when the app is minimized/suspended, or if another app is being used, or if the screen is turned off, location stops being tracked. And the timer pauses in the background as well. I restructured some of this code for location tracking to work on a background thread like following, but no changes in results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;mapViewModel.locationDataSource.LocationChanged += async (sender, e) =&amp;gt; await LocationChanged(sender, e); // call LocationChanged method when location changes in LocationDataSource

private async Task LocationChanged(object sender, Esri.ArcGISRuntime.Location.Location e)
    {
        await Task.Run(() =&amp;gt; { 
            MapPoint mp = e.Position;
            UpdatePolyline(mp)
    }

private void UpdatePolyline(MapPoint mp)
    {
        polylineBuilder.AddPoint(mp);
        Geometry polylineGeometry = polylineBuilder.ToGeometry();

        // UI updates marshaled to the main thread.
        MainThread.BeginInvokeOnMainThread(() =&amp;gt;
        {
            trackedHikePolylineGraphicsOverlay.Graphics.Clear();
            trackedHikePolylineGraphicsOverlay.Graphics.Add(new Graphic(polylineGeometry));
            
        });
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also added these permissions to my AndroidManifest.xml&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/&amp;gt;
&amp;lt;uses-permission android:name="android.permission.FOREGROUND_SERVICE"/&amp;gt;
&amp;lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&amp;gt;
&amp;lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will also need to add similar permissions to the .plist for iOS permissions. Not sure what they are yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What have other developers done to implement background location tracking in their .NET MAUI apps? I know Android and iOS apps can do this, because I can record a manual activity in Strava while my screen is turned off. Permissions for my Maui app is set to "Allow location all the time" for Precise location.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 22:51:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565247#M13162</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-06T22:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565841#M13164</link>
      <description>&lt;P&gt;I am going to first start by asking what version of .NET Maps SDK are you using? There have been a few location related fixes in past couple releases. I recommend using latest version (200.6) of .NET Maps SDK to test this.&lt;/P&gt;
&lt;P&gt;We also have a tutorial on &lt;A href="https://developers.arcgis.com/net/device-location/tutorials/display-device-location-maui/" target="_blank"&gt;display device tutorial&lt;/A&gt; for .NET MAUI that talks about enabling location in .NET MAUI Applications. Tutorial provides step-by-step directions to create an app or you can download the solution and try it yourself. Tutorial also provides information about required permission that might be helpful for iOS and Android. I think you need following two added to the Android manifest.&lt;/P&gt;
&lt;P&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&amp;gt;&lt;BR /&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&amp;gt;&lt;/P&gt;
&lt;P&gt;There is a section on iOS permissions on that tutorial that will provide guidance on setting up iOS permissions.&lt;/P&gt;
&lt;P&gt;If you still encounter an issue, provide us a reproducible case and I will be more than happy to take a look.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Preeti&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 21:39:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565841#M13164</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2024-12-06T21:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565884#M13165</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1217"&gt;@PreetiMaske&lt;/a&gt;&amp;nbsp;, thank you for your reply. It's great to have your support on this issue.&lt;/P&gt;&lt;P&gt;We are using &lt;FONT face="courier new,courier"&gt;200.6.0&lt;/FONT&gt; of&amp;nbsp;Esri.ArcGISRuntime.Maui and are upgraded on pretty much all Nuget packages.&lt;/P&gt;&lt;P&gt;I should apologize and say I neglected to include all Android permissions I'm using in the original post. I updated my post to reflect all permissions we're requesting in Android that are location related. As you can see, we are requesting &lt;FONT face="courier new,courier"&gt;FINE_LOCATION&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;COARSE_LOCATION&lt;/FONT&gt; permissions.&lt;/P&gt;&lt;P&gt;I pulled the sample app you linked to and ran it locally. I'm experiencing the same issue with this sample, because the issue is NOT with being able to access user's location while the app is running in the foreground. The problem arises when the user needs to shut the screen off and hike with the phone in their pocket, or switch apps to take a picture of a squirrel. When they have to do this, the location stops being tracked. If you look at the below screenshot, the purple graphic shows the route the user takes with the phone in their pocket.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_20241205-085335.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121075i0C1087767D1D6059/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot_20241205-085335.png" alt="Screenshot_20241205-085335.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There are sharp cuts to the user's current location when they turn their screen back on and go back to the app. In other words, the application only records location in the foreground.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice that in the sample you provided, ACCESS_BACKGROUND_LOCATION permission is not enabled, implying it was meant to run only in the foreground.&amp;nbsp;Are there are any samples out there for getting this info from the device on a background thread or using background/foreground services perhaps?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try and upload a more complete solution of just this tracking feature from my application to a new repo, so you can pull it and check the code yourself. Thank you for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 23:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565884#M13165</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-06T23:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565918#M13166</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1217"&gt;@PreetiMaske&lt;/a&gt;&amp;nbsp;Here is a project on Github you can pull and run yourself:&amp;nbsp;&lt;A href="https://github.com/Cesium133/.netmaui-display-device-location" target="_blank" rel="noopener"&gt;https://github.com/Cesium133/.netmaui-display-device-location&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I created this from the Display Device Location sample you provided and the &lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/tree/main/src/WPF/WPF.Viewer/Samples/Location/ShowLocationHistory" target="_self"&gt;Show Location History&lt;/A&gt; sample from the Maps SDK team. You will see that if you run this on a physical device, the location will not update if the app is suspended or minimized.&lt;/P&gt;&lt;P&gt;Please let me know what else you may need to help us debug this issue! Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 01:10:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1565918#M13166</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-07T01:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1566961#M13169</link>
      <description>&lt;P&gt;We're working on a sample/tutorial/doc to help with this scenario. But take a look at Android's doc on this, especially foreground service (keeps app open in the background):&lt;BR /&gt;&lt;A href="https://developer.android.com/develop/background-work/services/fgs" target="_blank"&gt;https://developer.android.com/develop/background-work/services/fgs&lt;/A&gt;&lt;BR /&gt;and background services:&amp;nbsp;&lt;A href="https://developer.android.com/develop/sensors-and-location/location/background" target="_blank"&gt;https://developer.android.com/develop/sensors-and-location/location/background&lt;/A&gt;&amp;nbsp;(runs while app isn't running)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 20:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1566961#M13169</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-12-10T20:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567824#M13170</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1052"&gt;@dotMorten_esri&lt;/a&gt;&amp;nbsp;! With some elbow grease, we've managed to get background location tracking working on Android with Foreground service. When I get a chance (probably not anytime soon), I will update my Github repo with the code we used. Meanwhile here is what we used in LocationService.cs that we added to Platforms/Android directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using AndroidX.Core.App;
using Esri.ArcGISRuntime.Location;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using Microsoft.Maui.Devices.Sensors;
using Resource = Microsoft.Maui.Resource;
using Location = Esri.ArcGISRuntime.Location.Location;

namespace MyApp.Platforms.Android.LS;

[Service(ForegroundServiceType = global::Android.Content.PM.ForegroundService.TypeLocation)]
public class LocationService : Service
{
    public override IBinder OnBind(Intent intent) =&amp;gt; null;
    public event EventHandler&amp;lt;Location&amp;gt; LocationUpdated;
    public LocationDataSource locationDataSource;

    private async void OnLocationChanged(Location newLocation)
    {
        LocationUpdated?.Invoke(this, newLocation);
    }

    public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
    {
        StartForeground(1, CreateNotification());

        var locationIntent = new Intent(this, typeof(LocationService));
        if (Build.VERSION.SdkInt &amp;gt;= BuildVersionCodes.O)
        {
            StartForegroundService(locationIntent);
        }
        else
        {
            StartService(locationIntent);
        }
        return StartCommandResult.Sticky;
    }

    private Notification CreateNotification()
    {
        // don't really need notifications for our app, but examples online used it
        var channelId = "location_notification";
        var channelName = "Location Tracking";
        var notificationManager = (NotificationManager)GetSystemService(NotificationService);
        var channel = new NotificationChannel(channelId, channelName, NotificationImportance.Default);
        notificationManager.CreateNotificationChannel(channel);

        var notification = new NotificationCompat.Builder(this, channelId)
            .SetContentTitle("Location Tracking")
            .SetContentText("Tracking location in the background")
            //.SetSmallIcon(Resource.Drawable.icon)
            .Build();

        return notification;
    }


    public async Task&amp;lt;LocationDataSource&amp;gt; StartLocationUpdates()
    {
            locationDataSource = new SystemLocationDataSource();
            PermissionStatus status = await Permissions.CheckStatusAsync&amp;lt;Permissions.LocationWhenInUse&amp;gt;();
            if (status == PermissionStatus.Denied || status == PermissionStatus.Unknown)
            {
                await Shell.Current.DisplayAlert("Access Requested", "Please allow precise location all the time to track while phone is locked or viewing other applications.", "OK");
                status = await Permissions.RequestAsync&amp;lt;Permissions.LocationWhenInUse&amp;gt;();
            }

            if (status != PermissionStatus.Granted)
            {
                return null;
            }

            await locationDataSource.StartAsync();
            locationDataSource.LocationChanged += async (sender, e) =&amp;gt; OnLocationChanged(e);
            return locationDataSource;

    }


}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We call StartLocationUpdates() from the MapPage.xaml.cs and set LocationDataSource&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await this.locationService.StartLocationUpdates();
mapViewModel.locationDataSource = this.locationService.locationDataSource;

if (mapViewModel.locationDataSource.Status == LocationDataSourceStatus.Started)
            {
                MyMapView.LocationDisplay.DataSource = mapViewModel.locationDataSource;
                MyMapView.LocationDisplay.IsEnabled = status == PermissionStatus.Granted || status == PermissionStatus.Restricted;
                MyMapView.LocationDisplay.InitialZoomScale = 1000;
                MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Recenter;
            }

this.locationService.LocationUpdated += async (sender, e) =&amp;gt; await LocationUpdated(sender, e);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works like a dream when it's not killing the battery. We're working on implementing this in iOS right now with &lt;A href="https://learn.microsoft.com/en-us/dotnet/api/corelocation.cllocation?view=xamarin-ios-sdk-12" target="_self"&gt;CLLocation.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 16:06:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567824#M13170</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-12T16:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567850#M13171</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1052"&gt;@dotMorten_esri&lt;/a&gt;&amp;nbsp;! With some elbow grease, we've managed to get background location tracking working on Android with Foreground service. When I get a chance (probably not anytime soon), I will update my Github repo with the code we used. Meanwhile here is what we used in LocationService.cs that we added to Platforms/Android directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using AndroidX.Core.App;
using Esri.ArcGISRuntime.Location;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using Microsoft.Maui.Devices.Sensors;
using Resource = Microsoft.Maui.Resource;
using Location = Esri.ArcGISRuntime.Location.Location;

namespace MyApp.Platforms.Android.LS;

[Service(ForegroundServiceType = global::Android.Content.PM.ForegroundService.TypeLocation)]
public class LocationService : Service
{
public override IBinder OnBind(Intent intent) =&amp;gt; null;

public event EventHandler&amp;lt;Location&amp;gt; LocationUpdated;
int count = 0;
public LocationDataSource locationDataSource;

private async void OnLocationChanged(Location newLocation)
{
LocationUpdated?.Invoke(this, newLocation);
}

public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
StartForeground(1, CreateNotification());

var locationIntent = new Intent(this, typeof(LocationService));
if (Build.VERSION.SdkInt &amp;gt;= BuildVersionCodes.O)
{
StartForegroundService(locationIntent);
}
else
{
StartService(locationIntent);
}
return StartCommandResult.Sticky;
}

private Notification CreateNotification()
{
// don't really need notifications for our app, but examples online used it
var channelId = "location_notification";
var channelName = "Location Tracking";
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
var channel = new NotificationChannel(channelId, channelName, NotificationImportance.Default);
notificationManager.CreateNotificationChannel(channel);

var notification = new NotificationCompat.Builder(this, channelId)
.SetContentTitle("Location Tracking")
.SetContentText("Tracking location in the background")
//.SetSmallIcon(Resource.Drawable.icon)
.Build();

return notification;
}


public async Task&amp;lt;LocationDataSource&amp;gt; StartLocationUpdates()
{
locationDataSource = new SystemLocationDataSource();
PermissionStatus status = await Permissions.CheckStatusAsync&amp;lt;Permissions.LocationWhenInUse&amp;gt;();
if (status == PermissionStatus.Denied || status == PermissionStatus.Unknown)
{
await Shell.Current.DisplayAlert("Access Requested", "Please allow precise location all the time to track while phone is locked or viewing other applications.", "OK");
status = await Permissions.RequestAsync&amp;lt;Permissions.LocationWhenInUse&amp;gt;();
}

if (status != PermissionStatus.Granted)
{
return null;
}

await locationDataSource.StartAsync();
locationDataSource.LocationChanged += async (sender, e) =&amp;gt; OnLocationChanged(e);
return locationDataSource;

}


}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We call StartLocationUpdates() from the MapPage.xaml.cs and set LocationDataSource&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await this.locationService.StartLocationUpdates();
mapViewModel.locationDataSource = this.locationService.locationDataSource;

if (mapViewModel.locationDataSource.Status == LocationDataSourceStatus.Started)
{
MyMapView.LocationDisplay.DataSource = mapViewModel.locationDataSource;
MyMapView.LocationDisplay.IsEnabled = status == PermissionStatus.Granted || status == PermissionStatus.Restricted;
MyMapView.LocationDisplay.InitialZoomScale = 1000;
MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Recenter;
}

this.locationService.LocationUpdated += async (sender, e) =&amp;gt; await LocationUpdated(sender, e);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works like a dream when it's not killing the battery. We're working on implementing this in iOS right now with &lt;A href="https://learn.microsoft.com/en-us/dotnet/api/corelocation.cllocation?view=xamarin-ios-sdk-12" target="_self"&gt;CLLocation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 16:34:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567850#M13171</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-12T16:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567860#M13172</link>
      <description>&lt;P&gt;Awesome! Glad you got it working and thank you for bringing this up - this made us realize we need to help with a little more guidance here, and are working on that now. Wrt iOS, note that there are a few specific properties on iOS only to enable background location on the SystemLocationDatasource. You'll need to put that code in an "#if __IOS__" section since it only applies to ios that will turn on backgrounding of location. See the doc here and the remarks:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;nbsp;&lt;A href="https://developers.arcgis.com/net/api-reference/api/ios/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Location.SystemLocationDataSource.AllowsBackgroundLocationUpdates.html" target="_blank"&gt;https://developers.arcgis.com/net/api-reference/api/ios/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Location.SystemLocationDataSource.AllowsBackgroundLocationUpdates.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A style="font-family: inherit;" href="https://developers.arcgis.com/net/api-reference/api/ios/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Location.SystemLocationDataSource.ActivityType.html" target="_blank"&gt;https://developers.arcgis.com/net/api-reference/api/ios/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Location.SystemLocationDataSource.ActivityType.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You shouldn't need to work with CLLocation directly.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 16:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1567860#M13172</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-12-12T16:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568898#M13175</link>
      <description>&lt;P&gt;Wow, that is amazingly simple! And it looks like it works great on IOS! (handles keeping the associated processes active as well) Thanks!&lt;BR /&gt;I was searching for similar within the .NET android documentation and could not find anything related, do you have any suggestions on the best way to handle that?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:39:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568898#M13175</guid>
      <dc:creator>SeanS</dc:creator>
      <dc:date>2024-12-16T15:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568908#M13176</link>
      <description>&lt;P&gt;Thanks! The SDK makes it incredible simple for iOS for location tracking. Hopefully similar things in store for Android soon&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":crossed_fingers:"&gt;🤞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm out of the office, so getting my colleague and fellow developer&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/735347"&gt;@SeanS&lt;/a&gt;&amp;nbsp;to move this forward. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:56:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568908#M13176</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2024-12-16T15:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568957#M13177</link>
      <description>&lt;P&gt;Unfortunately the Android platform makes implementing the scenario a lot harder and has to be done at the application level with the foreground service. There's not much we can really do at the API level, besides improving our documentation to help implement this.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:07:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1568957#M13177</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-12-16T17:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking location in the background while .NET MAUI app is suspended or screen is off</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1570949#M13209</link>
      <description>&lt;P&gt;Thank you so much for sharing your code. This was the missing component I needed. I had been using Android Sensors to solve this problem (Microsoft.Maui.Devices.Sensor.Geolocation), and that was working great for me with the Foreground Service code similar to what you showed in your example. However, it would have required me to essentially write code similar to LocationDisplay (for creation of the various symbol properties)&amp;nbsp; , and I really wanted to just use the ESRI LocationDisplay code instead. But it got all messed up when the Android Devices would go to sleep.&amp;nbsp; I'll implement this shortly. Thanks again&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 15:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/tracking-location-in-the-background-while-net-maui/m-p/1570949#M13209</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2024-12-23T15:05:10Z</dc:date>
    </item>
  </channel>
</rss>

