1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| private LocationManager locationManager;
private LocationListener locationListener;
private LocationProvider locationProvider;
private Location actualLocation, lastLocation;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = (MapView) findViewById(R.id.mapView);
niceGP = new GeoPoint(43699651, 7227173);
perpignanGP = new GeoPoint(42698586, 2898559);
// essai de localisation
// http://developer.android.com/guide/topics/location/strategies.html
locationManager = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE);
locationListener = new LocationListener() {
public void onStatusChanged(String provider, int status,
Bundle extras) {
}
public void onProviderEnabled(String provider) {
}
public void onProviderDisabled(String provider) {
}
public void onLocationChanged(Location location) {
}
};
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
0, locationListener);
locationProvider = LocationManager.GPS_PROVIDER; |
Partager