Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
As the user travels with an Android device, the Route Tracker app monitors the user’s location and bearing (i.e., direction), visually displaying a route on a map. The user touches the Start Tracking ToggleButton (a button that maintains on–off state) to begin tracking a route (Fig. 11.1(a)). This also changes the ToggleButton’s text to Stop Tracking and displays a green bar to indicate that the app is tracking a route. The map shifts as the user moves, keeping the user’s current location centered on the screen (Fig. 11.1(b)). The route is a red line with black dots appearing after every 10 GPS data points received by the app (Fig. 11.1(b)). When you use this app on an Android device, the map is oriented such that the route tracking line is pointed in the direction the user is traveling (known as the user’s bearing), and that direction points to the top of the device. The sample outputs in this chapter show the app running in the Android emulator, which does not emulate bearing data. The user can choose the Map or Satellite options in the app’s menu (Fig. 11.2(a)) to change the map styles. Touching Map displays a Google™ Maps street map—the app’s default. Touching Satellite displays a satellite image of the area around the user (Fig. 11.2(b)).