J2ME and Location-Based Services

xiaoxiao2021-03-06  42

J2ME and Location-Based Services

Print-Friendly Version

Location-based services (LBS) provide users of mobile devices personalized services tailored to their 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 current traffic conditions , supplying routing information, helping them find nearby restaurants, and many more. This article introduces you to the field of LBS and to the Location API for J2ME (JSR 179), a set of generic APIs that 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 do I get there They determine the location of the? User by Using One of Several Technologies for determining position 911 emergency service that determines the caller's location automatically. Such a service would be extremely useful, especially to users who are far from home and do not know local landmarks. Traffic advisories, navigation help including maps and directions, and roadside assistance are natural location . -based services Other services can combine present location with 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 methods. Accuracy depends on the method used. Locations can be expressed in spatial terms or as text descriptions. A spatial location can be 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 prime meridian, which passes through Greenwich, England. Altitude is expressed in meters above sea level. A text description is usually expressed as a street Address, INCLUDING, POSTAL CODE, AND SO ON. Applications Call on any of several types of positioning methods.

Using the mobile phone network: The current cell ID can be used to identify the Base Transceiver Station (BTS) that the device is communicating with and the location of that BTS Clearly, the accuracy of this method depends on the size of the cell,. . and can be quite inaccurate A GSM cell may be anywhere from 2 to 20 kilometers in diameter Other techniques used along with cell ID can achieve accuracy within 150 meters Using satellites:.. The Global Positioning System (GPS), controlled by the US Department of Defense, uses a constellation of 24 satellites orbiting the earth. GPS determines the device's position by calculating differences in the times signals from different satellites take to reach the receiver. GPS signals are encoded, so the mobile device must be equipped with a GPS receiver . GPS IS Potentially The Most Accurate Method (Between 4 and 40 meters if the gps), But it has some drawbacks: The extra hardware can be costly, consumes battery . While in use, and requires some warm-up after a cold start to get an 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 provide locations along with other services. for example, appropriately equipped devices can use Bluetooth for short-range positioning. In addition, location methods can connect to a mobile position center that provides an Interface to query for the position of the mobile subscriber. The mobile subscriber. While Applications Can Be Fully Self-Contained On The Device, IT '

s clear that a wider array of services is possible when a server-side application is part of the overall service. Some applications do not need high accuracy, but others will be useless if the location is not accurate enough. It's okay for the location of a tourist walking around town to be off by 30 meters, but other applications and services may demand higher accuracy. The Location API for J2ME The Location API for J2ME specification defines an optional package, javax.microedition.location, that enables developers to write wireless location-based applications and services for resource-limited devices like mobile phones, and can be implemented with any common location method. The compact and generic J2ME location APIs provide mobile applications with information about the device's present physical location and orientation (compass direction ), And support the code and use of databases of known landmarks, Stored in The Device. JSR 179 Requires The Connected Device Configuration (CD C) or version 1.1 of the Connected Limited Device Configuration (CLDC). CLDC 1.0 is not adequate because it does not support floating-point numbers, which the API uses to represent coordinates and other measurements. The Location API does not depend on any particular profile - it can be used with MIDP or the Personal Profile The hardware platform determines which location methods are supported If it does not support at least one location provider, LBS will not be possible Applications can request providers... With particular characteristics, Such as a minimum degree of accountness. Some location;

. Others may entail service fees The application should warn the user before any charges are incurred It is up to 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 that object to obtain the location, 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 that indicates when the 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, represented as the radius of an area. The following segment of code demonstrates How to Obtain The Present Location of The Device Synchronously:

...

// set criteria for selecting a location provider:

// Accurate to 500 meters horizontally

Criteria cr = new criteria ();

Cr.SethorizontaCcuracY (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 CORDINATE INFORMATION

Double lat = c.getlatitude ();

Double lon = c.getlongitude ();

}

...

Landmarks A landmark is a location associated with a name and a description Landmarks can be stored in a device-based database, where they can be 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. You can create multiple named LandmarkStores to group locations into categories such as cinemas, museums, or customer sites. If the device includes a compass, the application may be able to determine not only its location but its orientation, which is useful in navigational applications. The Orientation class represents the device's azimuth as an angle from due north, which the application can easily convert to a compass direction. Security and Privacy Many users consider location Information to Be Highly Sensitive, And Are Concerned About a Number of Privacy Issues, Including: Target Marketing: Mobile Users' Locations Can Be Used To classify customers for focused marketing efforts Embarrassment:. One customer's knowledge of another's location may lead 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 these and other reasons, users must know when their location is given to an application Guidelines Keep the following guidelines in mind when designing location-. BASED SERVICES:

.

The device is cut off from any of the location methods it supports, in a tunnel or on an airplane for example. The user withholds permission to release the information. No location provider that the device supports is available. Depending on the method used, determining the location may take a long time. The delay may be so long that the end result is not 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 do not overuse fee-based services. Be sensitive to privacy concerns.Tell customers about the information being collected on them and how it will be used. Offer customers the choice of what location information to disclose, and when appropriate an option not to participate. Allow customers to review their permission profiles so that they know what they are permitting. Protect location information so that it can not be accessed by unauthorized persons. You should also take full advantage of the MIDP 2.0 security framework, which restricts the application's access to location data to cases in which the user explicitly confirms permission. Summary Through the Location API for J2ME, you can use information about the user's position to build new kinds of applications and 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 devices much easier. The critical issue that LBS developers must address Is The Privacy of The Customer. To Ensure Privacy, Folow Sound Programming Guidelines and Use The Security Framework IN MIDP 2.0.

转载请注明原文地址:https://www.9cbs.com/read-52194.html

New Post(0)