mohammedsuhail
mohammedsuhail

Reputation: 701

Latitude and Longitude of the current location

How i can get the latitude and longitude of the current location, from android?

Upvotes: 2

Views: 5132

Answers (1)

Umesh
Umesh

Reputation: 4256

you can use the LocationListener class to get the coordinates while on the move.

use the following to get the coordiates when not on the move.

LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);    
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);  

if(location == null){
    LAT = 0.0;
    LONG = 0.0;
    loc.setText("No Location");
}

for an indepth discussion --

http://www.devx.com/wireless/Article/39239/1954

Upvotes: 3

Related Questions