Finding a location can be performed in two ways. The first involves using the device network and/or GPS sensors to locate the device in real-time. The second uses a known location (for example, an address) and looks up the GPS coordinates via the Internet. Both approaches will be demonstrated. When working with maps, you can use the map’s
getMyLocation() method to get the device’s current GPS coordinates. If you need to get location without using a map, there is more work involved. In this section, you build and test several versions of
ContactMapActivity to learn different approaches to getting location before building the final one used for the app.