Services J2ME and location-based services
print-friendly Version
Location-based Services (LBS) provide users of mobile devices personalized services tailored to their the current Location. They open a new market for developers, cellular network operators, and service providers to develop and deploy value-added Services:advising users of traffic conditions, supplying routing information, helping them find nearby Restauran TS, and many more.
This article introduces the "Field of LBS and to" Location API for J2ME (JSR 179), a set of generic APIs which can be used for developing location-based services. In addition, the article offers guidelines for designing location-based services.
What location-based Services Do
Location-based Services Answer three questions:where am I? What ' s around me? How does I get there? They determine the location of the user by using one of several technologies for determining position, then using the Locati On and, information to provide personalized applications and services. As a example, consider a wireless 911 emergency service that determines the caller ' s location automatically. Such A service would is extremely useful, especially to the users who are far the from home and don ' t know the local landmarks. Traffic advisories, navigation help including maps and directions, and roadside assistance are natural location-based Ices. Other services can combine present location and information about personal preferences to help users find food, lodging, and entertainment to fit their tastes and pocketbooks.
There are two basic approaches to implementing location-based services:
Process location data in a server and deliver results to the device.
Obtain location data for a device-based application that uses it directly.
This article focuses on device-based location services.
Determining the Device ' s Location
To discover the location of the device, LBS must use real-time positioning. Accuracy depends on the method used.
Locations can be expressed in spatial terms or as text descriptions. A spatial location can is expressed in the widely used latitude-longitude-altitude coordinate system. Latitude is expressed as 0-90 degrees North or south of the equator, and longitude as 0-180 degrees East or west of the PR IME Meridian, which passes through Greenwich, England. Altitude is expressed at meters above sea level. A text description is usually expressed as a street address, including city, postal code, and.
Applications can call to any of several types of positioning methods.
Using the mobile phone network:the current cell ID can is used to identify the Base transceiver Station (BTS) that the de The vice is communicating with and the location of that BTS. Clearly, the accuracy of this method depends on the size of the cell, and can is quite inaccurate. A GSM cell May is anywhere from 2 to kilometers in diameter. Techniques used along with cell ID can achieve accuracy within.
Using satellites:the Global positioning System (GPS), controlled by the US Department of Defense, uses a constellation of Satellites orbiting the Earth. GPS determines the device ' s position by calculating differences in the times signals from different satellites take to REA CH the receiver. GPS signals are encoded, so the mobile device must is equipped with a GPS receiver. GPS is potentially the most accurate method (between 4 and meters if the GPS receiver has a clear view of the sky), but It has some drawbacks:the extra hardware can be costly, consumes battery-in-use, and requires some-after a Cold start to get a initial fix on visible satellites. It also suffers from ' canyon effects ' in cities, where satellite visibility is intermittent.
Using short-range positioning beacons:in relatively small areas, such as a single building, a local area network can Prov IDE locations along with other services. For example, appropriately equipped devices can with Bluetooth for short-range positioning.
In addition, location methods can connect to a mobile position center which provides an interface to query for the position of the mobile subscriber. The API to the mobile position Center is xml-based. While applications can being fully self-contained on the device, it's clear that a wider array of services are possible when a Server-side application is part of the overall service.
Some applications don ' t need high accuracy, but others would be useless if the location isn ' t accurate. It's okay for the location's a tourist walking around town to is off from meters, but other applications and services MA Y demand higher accuracy.
The Location API for J2ME
The Location API for J2ME specification defines a optional package, javax.microedition.location, that enables To write wireless location-based applications and services for resource-limited devices like mobile phones, and can imp lemented with no common location method. The compact and generic J2ME location APIs provide mobile applications with information about the device ' s present Physica L Location and orientation (compass direction), and support the creation and use of databases of known, landmarks I n the device.
JSR 179 requires the Connected Device Configuration (CDC) or version 1.1 of the Connected Limited Device Configuration (CL DC). CLDC 1.0 isn ' t adequate because it doesn ' t support floating-point, numbers the API which to uses represent s and other measurements. The Location API doesn ' t depend on any particular profiles-it can be used with MIDP or the Personal profile.
The hardware platform determines which location methods. If it doesn ' t support at least one location provider, LBS won ' t be possible. Applications can request providers with particular characteristics, such as a minimum degree of accuracy. Some location methods May is free; Others may entail service fees. The application should warn the user before any charges are.
It is the the "application to" determine the criteria for selecting the location method. Criteria Fields Include:accuracy, response time, need for altitude, and speed. Once the application obtains a Locationprovider instance that meets the criteria, it can use this object to obtain the LOC ation, in either of two ways:
Invoke a method synchronously to get a single location.
Register a listener and get periodic updates at application-defined intervals.
The Location class abstracts the Location results. Its object contains coordinates, speed if available, textual address if available, and a time stamp then indicates when th E location measurements were made.
Coordinates are represented by either of two classes:
A coordinates object represents a point's latitude and longitude in degrees, and altitude in meters.
A Qualifiedcoordinates object contains latitude, longitude, and altitude, and also an indication of their accuracy, repres Ented as the radius of a area.
The following segment of code demonstrates how to obtain the present location of the device:
...
Set criteria for selecting a location provider:
Accurate to meters horizontally
Criteria cr= new Criteria ();
Cr.sethorizontalaccuracy (500);
Get an instance of the provider
Locationprovider lp= Locationprovider.getinstance (CR);
Request the location, setting a One-minute timeout
Location L = lp.getlocation (60);
Coordinates c = l.getqualifiedcoordinates ();
if (c!= null) {
Use coordinate information
Double lat = c.getlatitude ();
Double lon = C.getlongitude ();
}
...
Landmarks
A landmark is a location associated with a name and a description. Landmarks can is stored in a device-based database where they can is shared among all J2ME applications. Landmarks can store frequently used locations:home, office, favorite restaurants, and so on. Each is represented by a Landmark instance, and the database by a landmarkstore. Can create multiple named Landmarkstores to group locations into categories such as cinemas, museums, or customer site S.
If the device includes a compass, the application may is able to determine not only it location but its orientation, whic H is useful in navigational applications. The orientation class represents the device ' azimuth as a angle from due north, which the application can easily convert to a compass direction.
Security and privacy
Many users consider location information to is highly sensitive, and are concerned about a number of privacy issues, INCLU Ding
Target marketing:mobile users ' locations can is used to classify customers for focused marketing.
Embarrassment:one customer ' s knowledge of another ' s location may leads to embarrassing situations.
Harassment:location information can be used to harass or attack a user.
Service DENIAL:A health insurance firm might deny a claim if it learned that a user visited a high-risk area.
Legal restrictions:some countries regulate the use of personal data.
For this and other reasons, the users must know when their location was given to a application.
Guidelines
Keep the following guidelines in mind when designing services:
Handle unavailability of services gracefully. The user ' s location may not always is available for any of the several reasons.
The device is cut to the location methods it supports, in a tunnel or on a airplane for example.
The user withholds permission to release the information.
No location Provider The device supports is available.
Depending on the "method used", determining the location may take a long time. The delay may is so long this end result isn ' t useful in, for example, a navigation application. Keep the user informed.
Location service fees, typical of network-assisted Location methods, can add up quickly, so don ' t overuse fee-based Es.
Be sensitive to privacy concerns.
Tell customers about the information being collected on them and it'll be used.
Offer customers the choice of what location information to disclose, and when appropriate a option not to participate.
Allow customers to review their permission profiles, so, they know what and they are.
Protect location information So it cannot is accessed by unauthorized persons.
You are should also take full advantage of the MIDP 2.0 security framework, which restricts the application ' s access to Locati On data to cases in which the user explicitly confirms permission.
Summary
Through the Location API for J2ME, your can use information about the user's position to build new kinds of applications a D Services for mobile devices such as cell phones and PDAs, and to enhance existing services. JSR 179 Specifies a generic API for obtaining locations, and thus makes porting LBS applications to a wide range of device s much easier. The critical issue that LBS developers must address is the privacy of the customer. To ensure privacy, follow sound programming guidelines with the security framework in MIDP 2.0.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.