Finding Your Location

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.

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.