Hi all,
I am currently trying to simulate GPS fixs with android emulator, but
I encountered some problems. I can run the app, clic on the send
button in the emulator control, but, only the first click provides a
position. I am running an ubuntu jaunty, eclipse and SDK 1.5, on a
french system with the locale EN_US
Here is my code :
private class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
String s = "";
s += loc.getLatitude();
s += " ";
s += loc.getLongitude();
Toast.makeText(getBaseContext(),
"Location changed : Lat: " + loc.getLatitude() +
" Lng: " + loc.getLongitude(),
Toast.LENGTH_SHORT).show();
Log.i("GPS", s);
}
else {
Log.i("Gps","loc_null");
}
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
Log.i("Gps","onProviderDisabled");
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
Log.i("Gps","onProviderEnabled");
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
Log.i("Gps","onStatusChanged : " + provider);
}
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//---use the LocationManager class to obtain GPS locations---
lm = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
locationListener);
}
Can you tell me what I am doing wrong ?
Regards,
Olivier
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---