Thursday 23 June 2011

Location basics

Add this to AndroidManifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


Add this to Java: more info

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
LocationListener locationListener = new LocationListener() {
// Implement methods
}


Finally - This is the cool bit! On the command line type this for the simulator to receive a location update!:

telnet localhost 5554
geo fix 0.1 51.5

1 comment:

  1. More complete Location sample here:
    http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-an/3145655#3145655

    ReplyDelete