Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Android How to Program Chapter 11 Solution Manual


 

Download  file with the answers

If you are not a member register here to download this file 


 

11 Route Tracker App
Objec t ives
In this chapter you’ll:
■ Test an app that uses GPS
location data in the Android
Emulator and use the Eclipse
DDMS perspective to send
sample GPS data to the
emulator.
■ Use the external Maps API
framework and the
MapActivity and
MapView classes to display
Google Maps™ generated by
Google web services.
■ Get a Google Maps™ API key
unique to your development
computer.
■ Use location services and the
LocationManager class to
receive information on the
device’s position and bearing
(direction).
■ Display the user’s route using
an Overlay on a MapView
and GPS location data
received in the form of
Location objects.
■ Orient a map to the user’s
current bearing.
■ Use the PowerManager to
keep the device awake.
Self-Review Exercisess 2
Self-Review Exercisess
11.1 Fill in the blanks in each of the following statements:
a) Class provides access to the device’s location services.

b) To determine when the device has a GPS fix—that is, the device has “locked onto”
enough GPS satellites to receive GPS data for tracking—we implement the
interface.

c) Class (package android.view) provide’s access to the device’s screen dimensions.

d) The permission : indicates that this app requires Internet access to download
map and satellite images.

e) You use a to programmatically zoom in and out of a map and to change
the geographic location appearing centered in the MapView.

f) MapController’s method moves the center of the map to the given Geo-
Point using a smooth animation.

g) MapController’s method moves the center of the map to the given Geo-
Point using a smooth animation.

11.2 State whether each of the following is true or false. If false, explain why.
a) (True/False) To create your own app using the Google Maps API, you’ll need to obtain
a unique API key from Google.

b) (True/False) If you’d like your app to use most of the screen to display maps, you can
hide the title bar by using one of the standard Android themes, which can be specified
with the attribute android:theme in the activity element. A theme changes the lookand-
feel of an app’s GUI.

c) (True/False) Shared Android services include those that allow an app to change power
settings, obtain location data, control whether a device is allowed to sleep, and more.

d) (True/False) MapViews support gestures to zoom and pan the map—any additional functionality
must be added programmatically.

e) (True/False) LocationManager’s getBestProvider method returns a String representing
the name of the location provider that best meets the given Criteria. The true argument
indicates that only an enabled provider should be returned.

f) (True/False) Class PowerManager enables the app to control a device’s power state so
that, for example, the app can record location data even if the screen is off.

3 Chapter 11 Route Tracker App
Exercises
11.3 Fill in the blanks in each of the following statements:
a) To access a nonstandard library—that is, one that’s not included with the core Android
APIs, such as the Google Maps API—you must indicate the library’s name in the app’s
manifest with a element nested in the application element.

b) To access shared Android services, you must request permission to use them in the manifest
file with elements nested in the root manifest element. When a user
prepares to install an app, the operating system tells the user which permissions are being
requested and asks the user to confirm whether they should be granted. If not, the
app will not be installed.

c) To display data on a MapView, such as the line representing the route in this app, you
create a subclass of and override its draw method.

d) Once you have a location provider, you can request updates from it and have them delivered
to a LocationListener. The updates are delivered to the listener as
objects that represent the device’s geographic location—these include latitude and longitude
data, the time they were recorded and, depending on the location provider, may
also include altitude and speed data (some devices don’t have sensors for these).

e) Many GPS-based apps use LocationManager’s method to get the location
that was last reported when the device previously had a GPS fix (such as during a previous
execution of the app).

f) Class LocationManager provides access to the device’s location services and chooses the
best location provider based on the requirements you specify in a object.
To determine when the device has a GPS fix, you implement the GpsStatus.Listener
interface.

11.4 State whether each of the following is true or false. If false, explain why.
a) (True/False) Apps must be signed with a digital certificate before they can be installed
on a device. When you’re building and testing apps, the ADT Plugin handles this automatically
by creating a debug certificate and using it to sign your apps.

b) (True/False) Depending on your device, several location providers may be supported—
LocationManager provides capabilities for choosing the best one based on your app’s requirements,
which you specify in a Requirements object.

provides capabilities for choosing the best one based on your app’s requirements,
which you specify in a Criteria object.
c) (True/False) An app that changes the power settings can negatively affect the device’s
battery life when the app is executing, so class PowerManager should be used frequently.

life when the app is executing, so class PowerManager should be used sparingly.
d) (True/False) The permission android.permission.WAKE_LOCK indicates that this app
needs access to the PowerManager to prevent the device from sleeping while the app is
tracking a route.

Exercises 4
e) (True/False) High-accuracy GPS data uses less power. If your app doesn’t require such
accuracy, you can choose Criteria.ACCURACY_COARSE.

you can choose Criteria.ACCURACY_COARSE.
f) (True/False) A GeoPoint consists of a latitude and longitude measured in degrees.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!