1

I develop an application on android that retrieves the location of the user. In fact I need to use the most reliable service because I need a very precise location.

and I do not know what to do now, especially since I'm a beginner.

Thank you for helping me

Zombie_Colonel
  • 227
  • 1
  • 7
  • 17

1 Answers1

1
try {
            gps_enabled = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        } catch (Exception ex) {
        }
        try {
            network_enabled = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        } catch (Exception ex) {
        }

        if (!gps_enabled && !network_enabled) {
             // show alert 
        }
        if (network_enabled) {
            locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener);
        }
        if (gps_enabled) {
            locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
        }