140 likes | 223 Views
Android and Location. Mobile Computing. Unless otherwise stated, images are from android sdk. Latitude and Longitude determine location. Latitude = north/south of the equator Longitude = east/west of Greenwich. And where is Aberdeen?. What ’ s the latitude and longitude of Aberdeen?.
E N D
Android and Location Mobile Computing Unless otherwise stated, images are from android sdk Bruce Scharlau, University of Aberdeen, 2010
Latitude and Longitude determine location • Latitude = north/south of the equator • Longitude = east/west of Greenwich Bruce Scharlau, University of Aberdeen, 2010
And where is Aberdeen? What’s the latitude and longitude of Aberdeen? Bruce Scharlau, University of Aberdeen, 2010
Aberdeen is west of London 57.1467°N 2.0901°W http://www.earthtools.org/ Bruce Scharlau, University of Aberdeen, 2010
Use Google API for location • Select Google APIs for new projects using maps and location • Otherwise your app won’t run Bruce Scharlau, University of Aberdeen, 2010
Also put permissions in manifest • Need to add permissions for • INTERNET • ACCESS_COURSE_LOCATION • ACCESS_FINE_LOCATION Bruce Scharlau, University of Aberdeen, 2010
Manifest also needs to specify map library Apps with maps need to specify need as ‘true’ for com.google.android.maps library in manifest Bruce Scharlau, University of Aberdeen, 2010
Map layouts need API key • Need to get Google MAPs API key to use maps in your apps – referenced in layout http://code.google.com/android/add-ons/google-apis/mapkey.html This allows map tiles to be downloaded to your application Bruce Scharlau, University of Aberdeen, 2010
Direction API for routes included Can use direction API within maps API for routes http://www.anddev.org/google_driving_directions_-_mapview_overlayed-t826.html Bruce Scharlau, University of Aberdeen, 2010
LocationListener updates map This is about as simple as it gets for map display http://www.vogella.de/articles/Android/article.html#locationapi Bruce Scharlau, University of Aberdeen, 2010
Use DDMS tool to set location Bruce Scharlau, University of Aberdeen, 2010
Geocoder library to look up location Bruce Scharlau, University of Aberdeen, 2010
Can’t use external Bluetooth GPS devices with Android • Can’t use external BT device for location determination, as you can with Java ME • There is a separate app for this you can install and enable this feature: Bluetooth GPS Provider (not tried it yet) Bruce Scharlau, University of Aberdeen, 2010
Summary • Maps need API key to be displayed • Maps needs permissions set in manifest • Maps need API enabled • Lots of work done over network Bruce Scharlau, University of Aberdeen, 2010