I want to get longitude and latitude in Android emulator for testing.
Can any one guide me how to achieve this?
How do I set the location of the emulator to
Assuming you've got a mapview set up and running:
MapView mapView = (MapView) findViewById(R.id.mapview);
final MyLocationOverlay myLocation = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocation);
myLocation.enableMyLocation();
myLocation.runOnFirstFix(new Runnable() {
public void run() {
GeoPoint pt = myLocation.getMyLocation();
}
});
You'll need the following permission in your manifest:
And to send mock coordinates to the emulator from Eclipse, Go to the "Window" menu, select "Show View" > "Other" > "Emulator control", and you can send coordinates from the emulator control pane that appears.