5

I am little confused with the answers. can anybody give me a right answer to solve this question. I have developed an emergency alert app. I am getting location from GPS and Network service. In some situation there is no mobile data or WiFi connected so no internet.

I would like to know will my app still get LAT/LONG or is internet required to get LAT/LONG?

I am trying this on Galaxy Nexus which runs version 4.3...

I am using Google play service option:

@Override
public void onConnected(Bundle bundle) 
{
    locationRequest = LocationRequest.create();
    locationRequest.setInterval(1000);
    locationRequest.setFastestInterval(1000); 
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

    LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, locationRequest, this);
}

@Override
public void onLocationChanged(Location location) 
{
    Log.e("location","onLocationChanged");

    if (location != null) 
    {
      Log.e("SaveCurrent","Location"+String.valueOf(location.getLatitude()));
      Log.e("SaveCurrent","Location"+String.valueOf(location.getLongitude()));
    }
 }

Thanks!

TheDevMan
  • 5,914
  • 12
  • 74
  • 144

2 Answers2

2

GPS - Geolocation Positioning Services works using satellite, so no internet is required if your cellphone have GPS. So coordinates can be acquired using this alone which would be very accurate.

According to wikipedia also :- "The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites."

Internet Location - Other than GPS you can also get your current position using internet, which uses your mobile network or wifi network location to triangulate your current location. This is not as highly accurate as GPS.

So for your emergency application you can get the current location if GPS satellite services is available without having any internet connection.

Aks
  • 1,567
  • 13
  • 23
  • 1
    Exactly but in my case it is not happening. I am not able to get it working? – TheDevMan Dec 22 '14 at 06:22
  • @TheDevMan GPS signals are quite weak and often doesn't work indoors, have you tried testing in an outdoor setting? – Kai Dec 22 '14 at 06:24
  • @Kai - I am using fusedLocationApi. Please check my code - In this case I don't have to choose GPS or Network right? – TheDevMan Dec 22 '14 at 06:35
  • @TheDevMan I don't think so, what I was trying to point out is that, if the device doesn't have internet connection and is indoor, then it'll probably fail to get a location fix. – Kai Dec 22 '14 at 07:43
  • @Kai: In that case what is the use of Network provider? – TheDevMan Dec 22 '14 at 07:53
  • @Kai - Please have a look at these docs provided by android dev http://developer.android.com/guide/topics/location/strategies.html They explains how to use GPS or Network for Location services. – Aks Dec 22 '14 at 09:07
2

If you want reverse geocoding you will need an internet connection