GithubHelp home page GithubHelp logo

Comments (13)

igor-korotenko avatar igor-korotenko commented on May 27, 2024 2

+1.
Any answer from maintainers?
Bug seems to be too easy to reproduce for not being fixed for 4 years.

from location-samples.

saket avatar saket commented on May 27, 2024 1

I'm also struggling with this.

from location-samples.

Lomovskiy avatar Lomovskiy commented on May 27, 2024

Yes, I have the same problem!

from location-samples.

gmarques33 avatar gmarques33 commented on May 27, 2024

+1

from location-samples.

bnvinay92 avatar bnvinay92 commented on May 27, 2024

+1

from location-samples.

aspyct avatar aspyct commented on May 27, 2024

Same problem here. Looks like we won't get a fix anytime soon. Anybody has a good workaround to suggest?

from location-samples.

aspyct avatar aspyct commented on May 27, 2024

It seems you can still check for GPS and Network providers via the legacy LocationManager.

See below code (a bit specific, and Xamarin, but hey, you get the idea).

private IObservable<GoogleApiClient> ManualLocationCheck(GoogleApiClient client)
{
    Debug.WriteLine("Google can't tell us how to get location. Checking for ourselves");

    /*
    It looks like we can get a "Settings change unavailable" when the user
    is in airplane mode, but the location is enabled.
    So let's check whether location is enabled, because that's all we need.
    */
    var locationManager = (LocationManager)activity.GetSystemService(Context.LocationService);

    bool gpsEnabled;
    bool networkEnabled;

    try
    {
        Debug.WriteLine("Checking for GPS support");
        gpsEnabled = locationManager.IsProviderEnabled(LocationManager.GpsProvider);
    }
    catch (Exception e)
    {
        Debug.WriteLine(e);
        gpsEnabled = false;
    }

    try
    {
        Debug.WriteLine("Checking for network support");
        networkEnabled = locationManager.IsProviderEnabled(LocationManager.NetworkProvider);
    }
    catch (Exception e)
    {
        Debug.WriteLine(e);
        networkEnabled = false;
    }

    if (gpsEnabled || networkEnabled)
    {
        // Looks like we'll be able to get a location fix after all...
        OnUncertainLocationAvailability?.Invoke(new UncertainLocationAvailability
        {
            GpsEnabled = gpsEnabled,
            NetworkEnabled = networkEnabled
        });
        return Observable.Return(client);
    }
    else
    {
        // Nah, nothing we can do except ask the user to fix his settings
        throw new LocationNotAvailableException();
    }
}

from location-samples.

nidhishah-rally avatar nidhishah-rally commented on May 27, 2024

+1

from location-samples.

rakuishi avatar rakuishi commented on May 27, 2024

+1

from location-samples.

Rex1313 avatar Rex1313 commented on May 27, 2024

+1 It is hilarious that we need to use LocationManager as a backup

from location-samples.

dtunctuncer avatar dtunctuncer commented on May 27, 2024

+1

from location-samples.

farmazon3000 avatar farmazon3000 commented on May 27, 2024

same happened to me :(

from location-samples.

rolfwessels avatar rolfwessels commented on May 27, 2024

+1 Still having the same issue

from location-samples.

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.