0% found this document useful (0 votes)
27 views

Android: 1.2. Forward and Reverse Geocoding

Most Android devices allow determining current location via GPS, cell tower triangulation, or WiFi networks. The Android location API provides the LocationManager class to access location services and receive location updates. LocationManager supports selecting the best provider using a Criteria object and registering a LocationListener to receive periodic location updates. The Geocoder class allows determining coordinates from addresses and vice versa via forward and reverse geocoding.

Uploaded by

Yuva Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Android: 1.2. Forward and Reverse Geocoding

Most Android devices allow determining current location via GPS, cell tower triangulation, or WiFi networks. The Android location API provides the LocationManager class to access location services and receive location updates. LocationManager supports selecting the best provider using a Criteria object and registering a LocationListener to receive periodic location updates. The Geocoder class allows determining coordinates from addresses and vice versa via forward and reverse geocoding.

Uploaded by

Yuva Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Most Android devices allow to determine the current geolocation.

This can be done via a GPS (Global Positioning System) device, via cell tower triangulation or via wifi networks for which the geolocation is known. Android provides the package "android.location" which provides the API to determine the current geo position. The class "LocationManager" provides access to the location service . The Android device might have several providers available and you can select one of them. For a flexible selection of the best location provider use a "Criteria" object in which you can define how the provider should be selected. You can register a "LocationListener" with the "LocationManager" and will receive periodic updates about the geoposition. The class "LocationProvider" is the superclass of the different location providers which deliver the information about the current location. You can also register an Intent also allows to define a proximity alert, this alert will be triggered if the device enters a area given by a longitude, latitude and radius (proximity alert).

1.2. Forward and reverse Geocoding


The class "Geocoder" allow to determine the geo-coordinates (longitude, laditude) for a given address and possible addresses for given geo-coordinates. This process is known as forward and reverse geocoding.

1.3. Android Basics


The following assumes that you have already basic knowledge in Android development. Please check the Android development tutorial for the basics.

1.4. Google Maps


Google provides in the package "com.google.android.maps" a library for using Google Maps in Android. Google Maps is not part of the standard Open Source Platform Android and you require an additional key to use them. This key will be specified in the view which will be used to display the map. To use Google Maps in your application you need to add the following uses-library statement to your AndroidManifest.xml file. The project creation wizard does this automatically if you select a Google API version.

<uses-library android:required="true" android:name="com.google.android.maps"></uses-library>

The class "MapActivity" extends the class "Activity" and provides the life-cycle management and the services for displaying a Map in a "MapView". MapActivity is for maps what ListActivity is for lists. A "MapView" is typically defined in the layout for the MapActivity and requires the API key in the attribute android:apiKey. A MapView can be used with other UI components in the same layout. The class "MapController" can be used to interact with the "MapView", e.g. by moving it. A "Geopoint" is a position described via latitude and longitude and the class "Overlay" can be used to drawn on the map, for example position markers. The usage of Google Maps also requires the permission to access the Internet as the Google Maps data is read from it.

2. Google Map key


To use Google Maps you need an additional key. See Obtaining a Maps API Key to learn how to get an Google Maps API key. This process is a little bit time consuming and involves creating a value on the command line. This values is needed as input for a website which allow to create the key.

3. Android Device
3.1. Device with Google API
In case you want to use Google Maps in your emulator you have to create a device which supports the Google API's. This requires that you also install the "Google API" (see Android development tutorial ). During device creation select the target Google API's in the version of your SDK.

You might also like