Java Reference
In-Depth Information
Note that you can associate a category with multiple entries in the store, but each
entry can be associated with only a single category.
The
LandmarkStore
provides the following methods for adding, deleting, and updating
a
Landmark
in the store:
•
addLandmark
: Adds a new landmark to the store
•
deleteLandmark
: Deletes a landmark in the store
•
updateLandmark
: Updates an existing landmark in the store
•
removeLandmarkFromCategory
: Removes a category assigned to a specific
Landmark
Adding a
Landmark
requires you to pass both the instance of the
Landmark
to add and a
category name (or
null
to indicate no category).
You can search the existing
Landmark
instances in a store using one of the three
getLandmarks
methods it defines, all of which return an
Enumeration
of
Landmark
s. Passing
no arguments to
getLandmarks
enumerates
all
Landmark
s in the store. Passing
getLandmarks
a category name (or
null
) and a bounding rectangle of latitudes and longitudes gives you
an enumerated list of the
Landmark
instances within that rectangle, while passing just a
category (or
null
) and a name returns the
Landmark
instances in the category you specify
that possess the name you provide.
A
Landmark
itself is merely a container that holds a user's name, description, address
information, and coordinates; the class exposes these through accessors and mutators:
•
getName
and
setName
: Gets and sets the
Landmark
name
•
getDescription
and
setDescription
: Gets and sets the
Landmark
description
•
getAddressInfo
and
setAddressInfo
: Gets and sets the
Landmark
address, which is an
instance of
AddressInfo
•
getQualifiedCoordinates
and
setQualifiedCoordinates
: Gets and sets the
Landmark
's
location as an instance of
QualifiedCoordinates
Understanding the Role That Security Plays in LBS
Many users are understandably
very
sensitive about the interrelationship between loca-
tion and network services; privacy is often a key concern. Like most optional APIs, the
Location API requires privilege on platforms such as MIDP 2.0 that support it. As such,
your application may require carrier signing in order to operate on mobile devices once
you distribute it. Table 17-3 lists the permission names and protected methods in the
Location API. The API provides permissions not just for determining location, but also for
accessing the store of landmarks.