Hello,
First post in an android forum, so... quite new to this topic....
I didn't manage to get the following code working and didn't find
anything that could help me.
I'd just like to use the emulator to change the GPS coordinates and
track the effects in the logs.
I got the following from a tuto I found on the web:
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;
import android.os.Bundle;
import android.util.Log;
public class GPSTest extends Activity {
private LocationManager lm;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.e("GPS","BEFORE GPS STUFF");
lm = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
new LocationListener(){
public void onLocationChanged(Location arg0) {
String lat = String.valueOf(arg0.getLatitude());
String lon = String.valueOf(arg0.getLongitude());
Log.e("GPS", "location changed: lat="+lat+",
lon="+lon);
}
public void onProviderDisabled(String arg0) {
Log.e("GPS", "provider disabled " + arg0);
}
public void onProviderEnabled(String arg0) {
Log.e("GPS", "provider enabled " + arg0);
}
public void onStatusChanged(String arg0, int arg1, Bundle
arg2) {
Log.e("GPS", "status changed to " + arg0 + "-" + arg1
+ "-");
}
});
}
}
The only thing I got in the logs is something like: "status changer
to gps-1-"
and when I send new cordinates via the emulator, nothing happens
Why is "onLocationChanged" not triggered ?
thanks a lot for your help,
Luc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---