0

I made a little app in Android using OSMDroid library, my map is loading from assets. Now I want to put my GPS location on that map, but without using Internet connection. I found these

GpsMyLocationProvider provider = new GpsMyLocationProvider(getApplicationContext());
        provider.addLocationSource(LocationManager.GPS_PROVIDER);
        MyLocationNewOverlay myLocationNewOverlay = new MyLocationNewOverlay(provider, mapView);
        myLocationNewOverlay.enableMyLocation();
        Toast.makeText(getApplicationContext(),"my location "+        provider.getLastKnownLocation()
                ,Toast.LENGTH_LONG).show();
        mapView.getOverlays().add(myLocationNewOverlay);

but nothing changes.

3
  • see > stackoverflow.com/questions/35720609/…
    – Mapperz
    Commented Feb 24, 2019 at 20:37
  • Internet connection is not required to use geolocation on Android (and therefore with OSMdroid). So if it doesn't work it's most likely not related to the absence of an internet connection. There are several similar questions on stackoverflow.com so try to search a bit there: stackoverflow.com/search?q=%5Bosmdroid%5D+location. Your question is also a bit more suited for stackoverflow.com because it's about programming / using libraries and making things work in general. Commented Feb 25, 2019 at 8:13
  • I will ask there too. Thanks for suggestion. Commented Feb 25, 2019 at 9:07

1 Answer 1

1

... but without using Internet connection...

It depends on the positioning chip in your mobile device, if it was a:-

  • Fully autonomous GPS chip: power-hungry, works without cellular connection, but performs poorly in urban jungle.
  • Fully assisted GPS chip (A-GPS): must download "initialization" data from cellular network/connection, power-saving, performs fairly well in urban jungle.
  • Hybrid - functions as A-GPS if connected to cellular network, or if orbital information is made available via a file, or functions as fully autonomous GPS in the absence of cellular network/connection.

Hybrid GPS/A-GPS were offered in premium range of Windows CE mobile phones in the old days. But these days, all iOS and almost all Android mobile devices are fully A-GPS.

This link provides good descriptions of full GPS chip vs A-GPS chip.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.