SlideServe
Menu
Préférences
© SlideServe · v2026

Location based services

hank avatar
10 diapositives · 419 Views · Jul 18, 2014

Location based services. Some location-based services available in Android. Showing maps Annotating maps Geocoding Address -> location Reverse geocoding Location -> address(es) Getting live location information Through GPS, mobile phone cell tower triangulation, or Wi-Fi positioning.

Location based services - slide 1
01 / 10Location based services
1 / 17

Télécharger la présentation

Location based services
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Location based services Location based services

  2. Some location-based services available in Android • Showing maps • Annotating maps • Geocoding • Address -> location • Reverse geocoding • Location -> address(es) • Getting live location information • Through GPS, mobile phone cell tower triangulation, or Wi-Fi positioning Location based services

  3. Google maps • Google maps are NOT part of the Google API • It’s an add-on • Choose Google API when you create a new Eclipse project • Add another element to androidManifest.xml (inside the Application element) • <uses-library android:name="com.google.android.maps" /> • To use Google Maps in your Android application you must obtain a Google Maps API key from Google • https://developers.google.com/android/add-ons/google-apis/ • Special class com.google.android.maps.MapActivity • Example: Lee4Maps Location based services

  4. Some Map related classes • MapActivity • setBuiltInZoomControls(true) • Show ‘-’ and ‘+’ buttons to zoom out and in • setSatellite(true) • Satellite view • setStreetView(true) • I had problems with this on (sometimes) • GeoPoint • (latitude, longitude) in micro-degrees • Degrees * 1E6 (aka. 1 million) • Decimal, not sexagesimal • Sexagesimal, degrees:minutes:seconds, used in the navy • MapController • MapControler mc = mapActivit.getController(); • mc.animateTo(geoPoint) Location based services

  5. Map overlays • Map overlays are like a transparent films placed over a map. • Overlays can be annotated with different symbols, like pushpins • The class com.google.android.maps.Overlay • Often extends as an inner class inside a MapActivity class • Some methods • Draw(Canvas, MapView, shadow, when) • Enables you to annotate the overlay • onTouchEvent(MotionView, MapView) • Called then the user clicks the overlay Location based services

  6. Geocoding and reverse geocoding • Geocoder geocoder = new Geocoder(context, locale) • Geocoding • Address -> position • Geocoder.getFromLocation(latitude, longitude, howMany) • Reverse geocoding • Position -> Address(es) • Geocoder.getFromLocationName(location, howMany); • I had problems • ”Service not Available” in my emulator • Works on my phone. Location based services

  7. Getting location data:Where am I? • Some applications needs to know the current position of the user’s device. • Three ways to obtain the position • GPS satellite • Most accurate • Mobile phone cell tower triangulation • Works indoors • Wi-Fi • The address of the connected Wi-Fi should be known • Least accurate • AndroidManifest.xml • <uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION" /> • <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION" /> Location based services

  8. Location related classes and interfaces • Package: android.location • LocationManager • Class: Provides access to Android location services • LocationListener • Interface: Receiving notifications from LocationManager when location has changed • LocationProvider • Abstract class: Describes a location provider, like GPS • Location • Class: Geographic location • Example: location, Eclipse project Location based services

  9. Setting locations in the emulator • Eclipse: Use the DDMS perspective • Window -> Open Perspective -> DDMS • Emulator control tab / window • Scroll down to ”location controls” • You can send new locations to the emulator as often as you want • To simulate a moving device • I had problems!! Location based services

  10. Different location providers:Pros and cons • GPS_PROVIDER • Accurate • Works only outdoors • Device must have satellite connection • Consumes battery • Satellite connection consumes battery • Slow • NETWORK_PROVIDER • Less accurate • Works indoors (Wi-Fi + cell-tower) and outdoors (cell-tower) • Consumes less battery • Faster • Source • http://developer.android.com/guide/topics/location/obtaining-user-location.html Location based services