shinyorg / shiny

.NET Framework for Backgrounding & Device Hardware Services (iOS, Android, & Catalyst)
https://shinylib.net
MIT License
1.43k stars 227 forks source link

[Bug]: #1437

Closed cissemy closed 5 months ago

cissemy commented 5 months ago

Component/Nuget

GPS or Geofencing (Shiny.Locations)

What operating system(s) are effected?

Version(s) of Operation Systems

3.0

Hosting Model

Steps To Reproduce

run the app and click "Start" Button and minimize or run the app on the background

Expected Behavior

The app send geolocation running under background.

Actual Behavior

The app does not send geolocation.

Exception or Log output

No response

Code Sample

public interface ILocationService { Task StartListener(); Task StopListener();

} public class LocationService : ILocationService { private readonly IGpsManager gpsManager;

 public LocationService(IGpsManager gpsManager)
 {
     this.gpsManager = gpsManager;

 }

 public Task StartListener()
 {
     if (gpsManager.CurrentListener is not null)
         return Task.CompletedTask;

     return gpsManager.StartListener(new GpsRequest
     {
         BackgroundMode = GpsBackgroundMode.Realtime,
         Accuracy = GpsAccuracy.High,

     });
 }

 public Task StopListener()
 {
      return gpsManager.StopListener();
 }

}

public partial class MainPage : ContentPage { int count = 0; // IServiceTest Services; ILocationService svc; public MainPage(ILocationService _svc) { InitializeComponent(); svc = _svc;
} //method to start manually foreground service private void OnServiceStartClicked(object sender, EventArgs e) { svc.StartListener(); }

 //method to stop manually foreground service
 private void OnServiceStopClicked(object sender, EventArgs e)
 {
     svc.StopListener();
 }

}

Code of Conduct

aritchie commented 5 months ago

This is not an acceptable reproducible sample.