Another very interesting way of working would be to use LocationManager. When loading LocationListener can specify the shipping time and the distance from the last point of notification. The following example:

String provider = LocationManager.GPS_PROVIDER;
int t = 5000; // milliseconds
int distance = 5; // meters

LocationListener myLocationListener = new LocationListener() {

public void onLocationChanged(Location location) {
// Update application based on new location.
}

public void onProviderDisabled(String provider){
// Update application if provider disabled.
}

public void onProviderEnabled(String provider){
// Update application if provider enabled.
}

public void onStatusChanged(String provider, int status, Bundle extras){
// Update application if provider hardware status changed.
}

};


*locationManager.requestLocationUpdates(provider, t, distance,
myLocationListener);*

Em 14/06/2011 19:10, jtoolsdev escreveu:
Depends on what you mean by "easy."  You can get the "last known
location" without waiting using GPS but it if is out of date may
return nothing.  You can get the coarse location or the longitude and
latitude of the cell tower quickly too.  GPS to update and synchronize
can take a while so it is good to run it on a thread.  So whatever you
use depends on the granularity and how long you want to work.  None of
the APIs for this are all that daunting.

On Jun 14, 12:55 pm, bob<b...@coolgroups.com>  wrote:
is there any easy way I can get the latitude and longitude from my
phone?

I want to get it and plug it into Google maps on my PC.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to