Giter Site home page Giter Site logo

Comments (7)

aritchie avatar aritchie commented on June 11, 2024

One of these is for the background permissions. Notoriously and unfortunately, background modes have not worked without the usual coarse/precision request first.

I'm open to suggestions as I've been through a ton of use-cases and devices for this.

from shiny.

nZeus avatar nZeus commented on June 11, 2024

I experimented yesterday with the Xamarin Essentials implementation - that one doesn't open the "settings" page:

var request = new GeolocationRequest(GeolocationAccuracy.Best, TimeSpan.FromSeconds(10));
var location = await Geolocation.GetLocationAsync(request, CancellationToken.None);

But I would prefer to use Shiny library for that as it better does background services.

I don't understand why the "settings" page is opened when using the IGpsManager..

Also, that confuses me even more:
If I try MAUI version (Shiny.Locations v3), then it doesn't open the settings page, but I couldn't find how to use background reading in v3 (the UseGps<> was removed, I guess)

UPD. Oh, UseGps<> became AddGps<>, good. So, I tested v3 and it doesn't open the settings page, even if the background reader is enabled 👍

But, I don't know how to upgrade from v2 to v3... Things (like ShinyStartup and ShinyHost) have changed a lot...

from shiny.

aritchie avatar aritchie commented on June 11, 2024

I don't understand why the "settings" page is opened when using the IGpsManager..

Please read my previous response. It was what I tested. It was changed in v3 because foreground services didn't require the background manifest permission.

But, I don't know how to upgrade from v2 to v3... Things (like ShinyStartup and ShinyHost) have changed a lot...

It's a major version. There are lots of samples and templates that can help.

Ok v3 is all I support right now and if you don't have the issue there - then all is good.

from shiny.

nZeus avatar nZeus commented on June 11, 2024

The breaking changes are not documented, unfortunately, so that was a painful upgrade. But (I think) I managed to upgrade it to v3.

if you don't have the issue there - then all is good.

I am not convinced that the issue is fixed.

It seems that the gps background service is broken - I only get the first reading, and never get future readings...

What I do is

if (_gpsManager.IsListening())
{
    await _gpsManager.StopListener();
}
                
await _gpsManager.StartListener(GpsRequest.Realtime(true));

I have my delegate

public class MyGpsDelegate :
        Shiny.Locations.IGpsDelegate,
        Shiny.IAndroidForegroundServiceDelegate
{
    public Task OnReading(GpsReading reading)
    {
        Log("============ Background === Lat: " + reading.Position.Latitude);
            
        return Task.CompletedTask;
    }
...

the OnReading is only hit once.

Do you know if I can be missing something?

from shiny.

nZeus avatar nZeus commented on June 11, 2024

Actually, even the Foreground tracking doesn't get the new readings

from shiny.

aritchie avatar aritchie commented on June 11, 2024

The breaking changes are not documented, unfortunately, so that was a painful upgrade. But (I think) I managed to upgrade it to v3.

This isn't a product. I do the best I can with the time I have. Documenting upgrade processes just isn't something I have the time to do.

It seems that the gps background service is broken - I only get the first reading, and never get future readings...

I'm using it actively in a couple of projects and its working fine for me. File a new issue with a full reproducible sample and I can take look.

from shiny.

nZeus avatar nZeus commented on June 11, 2024

I'm sorry, I didn't mean to blame you. The library is great, and I appreciate the work you do!

--
I kept testing and debugging, until once I got a new reading after ~ 5 minutes. Then I decided to try AndroidGpsRequest with Interval set to 5 seconds instead of GpsRequest.Realtime(true) and I do get new readings now!
When the app is minimized, I don't see the logs anymore, I'll keep investigating this one.

But I agree, this issue can be marked as resolved (by upgrading from 2.7 to 3.0). 👍

Thank you for your help and the time spent

from shiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.