The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Accessing Location-Based Services

A popular feature on current-era mobile devices is GPS capability, so the device can tell you where you are at any point in time. While the most popular use of GPS service is mapping and directions, there are other things you can do if you know your location. For example, you might set up a dynamic chat application where the people you can chat with are based on physical location, so you are chatting with those you are nearest. Or, you could automatically “geotag” posts to Twitter or similar services.

GPS is not the only way a mobile device can identify your location. Alternatives include:

  1. Cell tower triangulation, where your position is determined based on signal strength to nearby cell towers
  2. Proximity to public WiFi “hotspots” that have known geographic locations
  3. GPS alternatives, such as GLONASS (Russia), Galileo (European Union, still under development), and Compass (China, still under development)

Android devices may have one or more of these services available to them. You, as a developer, can ask the device for your location, plus details on what providers are available. There are even ways for you to simulate your location in the emulator, for use in testing your location-enabled applications.

Prerequisites

Understanding this chapter requires that you have read the core chapters, particularly the chapter on threads.

Location Providers: They Know Where You’re Hiding

The preview of this section did not survive Thanos's finger snap.

Finding Yourself

The preview of this section was stepped on by Godzilla.

On the Move

The preview of this section is in an invisible, microscopic font.

Getting Locations via PendingIntent

The preview of this section was whisked away by a shark-infested tornado.

Are We There Yet? Are We There Yet? Are We There Yet?

The preview of this section was fed to a gremlin, after midnight.

Testing… Testing…

The preview of this section will not appear here for a while, due to a time machine mishap.

Alternative Flavors of Updates

The preview of this section was abducted by space aliens.

The Fused Option

The preview of this section was traded for a bag of magic beans.

Locations and Features

The preview of this section was stepped on by Godzilla.