I read some tutorials online, and found that LocationManager does this. This is the code I found online. However, I don't get it. Why can't I just get the long/lat? Why go through all the "change" location things...
lm=(LocationManager)this.getSystemService(LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10, 10, new LocationListener(){
@Override
public void onLocationChanged(Location location) {
Log.d("a","onLocationChanged: lat="+location.getLatitude());
Log.d("a","onLocationChanged: lat="+location.getLongitude());
}
@Override
public void onProviderDisabled(String provider) {
Log.d("a","onProviderDisabled: " +provider);
}
@Override
public void onProviderEnabled(String provider) {
Log.d("a","onProviderEnabled: " +provider);
}
@Override
public void onStatusChanged(String provider, int status,Bundle extras) {
Log.d("a","onStatusChanged: " +provider + status);
}
});
By the way, this code doesn't work. When I run it in a timer...nothing happens. Nothing gets logged. I just want the longitude latitude!!