Friday, May 28, 2010

Use the Location Based Services to figure out where we are and request updates when we move


Possibly the most enticing of the Android features are the Location Based Services that give your application geographical context through Location Providers (GPS etc). Android includes a mock provider called 'gps' that marches back and forth through San Fransisco. Alternatively you can create your own mock providers in XML.
You use the LocationManager to find your current position.
    locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = locationManager.getCurrentLocation("gps");

No comments:

Post a Comment