December 2013
Beginner
416 pages
12h 45m
English
Using the information you have discovered, you’ll now make the On Your Bike app a bit more robust. You’ll tell the user when GPS is turned off and will turn it on when required.
1. Open the WhereAmI class. You can find out a little more about the state of the GPS by adding a GPS status listener. In the startSearching method, just after requesting the location update, call addGpsStatusListener. Run Quick fix to implement the Listener interface, and run Quick fix again to add the onGpsStatusChanged method (see Listing 7.16).
Listing 7.16 Listening for Changes to the GPS Status
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { locationManager ...
Read now
Unlock full access