电信主站 网通分站
购买流程 付款方式 常见问题 在线提问 续租服务 购物车
用户名: 密 码: 忘记密码?
首 页
域名注册
虚拟主机
双线主机
服务器租用
VPS主机
企业邮局
代理专区
客服中心
虚拟主机行业资讯 虚拟主机评测对比 互联网最新动态 技术学院 站长资讯 在线教程 网站运营
搜索优化 服务器 网络编程 图形图象 站长之家 网页制作 操作系统
冲浪宝典 软件教学 视频通信 办公软件 邮件系统 网络安全 认证考试
您当前位置:西部数码->资讯中心-> 在线教程-> JSP教程
J2ME and Location-Based Services-JSP教程,J2ME开发
作者:网友供稿 点击:12
  西部数码-全国虚拟主机10强!20余项虚拟主机管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!虚拟主机可在线rar解压,自动数据恢复设置虚拟目录等.虚拟主机免费赠送访问统计,企业邮局.Cn域名注册10元/年,自助建站480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金!
文章页数:[1] 
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? whats around me? how do i get there? they determine the location of the user by using one of several technologies for determining position, then use the location and other information to provide personalized applications and services. as an example, consider a wireless 911 emergency service that determines the callers location automatically. such a service would be extremely useful, especially to users who are far from home and dont 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 devices 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 city, postal code, and so on.

applications can 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 devices 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 receiver has a clear view of the sky), 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 api to the mobile position center is xml-based. while applications can be fully self-contained on the device, its clear that a wider array of services is possible when a server-side application is part of the overall service.

some applications dont need high accuracy, but others will be useless if the location isnt accurate enough. its 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 devices present physical location and orientation (compass direction), and support the creation and use of databases of known landmarks, stored in the device.

jsr 179 requires the connected device configuration (cdc) or version 1.1 of the connected limited device configuration (cldc). cldc 1.0 isnt adequate because it doesnt support floating-point numbers, which the api uses to represent coordinates and other measurements. the location api doesnt 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 doesnt support at least one location provider, lbs wont be possible. applications can request providers with particular characteristics, such as a minimum degree of accuracy. some location methods may be free; 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 points 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.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 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 devices 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 customers knowledge of anothers 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:

handle unavailability of services gracefully. the users location may not always be available, for any of several reasons.
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 isnt 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 dont 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 cannot be accessed by unauthorized persons.
you should also take full advantage of the midp 2.0 security framework, which restricts the applications 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 users 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, follow sound programming guidelines and use the security framework in midp 2.0.


文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
相关主题
文章页数:[1] 
Google
热门文章
·IReport与JasperReport开发详解一-JSP教程,Java技巧及代码
·JSTL(JSP标准标签库)介绍-JSP教程,资料/其它
·格式化输入日期时间控件 JieFormattedDateBox-JSP教程,Java技巧及代码
·JSTL简化JSP编码-JSP教程,Jsp/Servlet
·JUnit和单元测试入门简介-JSP教程,Java技巧及代码
·从数据库中读取一个图片并保存为一个图片文件-JSP教程,数据库相关
·Java Swing入门基础-JSP教程,Java技巧及代码
·IntelliJ IDEA培训-JSP教程,Java技巧及代码
·通过JSP的预编译消除性能瓶颈-JSP教程,Jsp/Servlet
·Java中利用JMF编写摄像头拍照程序-JSP教程,Java技巧及代码

最新文章
·J2ME中的时间处理方法
·J2ME播放声音流程简介
·J2ME开发之手机键盘使用注意问题
·J2ME 记录管理存储
·MVC模式在j2me项目中的应用(二)
·MVC模式在j2me项目中的应用(一)
·J2ME中使用记录存储系统(RMS)存储信息
·J2ME与MIDP开发(1)
·用简单的J2ME程序测试MIDlet的生命周期
·JAVA基础:提升JSP应用程序的七大绝招


 
 


版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
  打印  刷新  关闭
返回首页 |关于我们 | 联系我们 | 付款方式 | 创业联盟 | 虚拟主机 | 资讯中心 | 友情链接 | 网站地图

版权所有 西部数码(www.west263.com)
CopyRight (c) 2002~2006 west263.com all right reserved.
公司地址:四川成都市万和路90号天象大厦4楼 邮编:610031
电话总机:028-86262244 86263048 86263408 86263960 86264018 86267838
售前咨询:总机转201 202 203 204 206 208
售后服务:总机转211 212 213 214
财务咨询:总机转224 223 传真:028-86264041 财务QQ:点击发送消息给对方635483282
售前咨询QQ:点击发送消息给对方2182518 点击发送消息给对方241975952 点击发送消息给对方275026793 点击发送消息给对方408235859
售后服务QQ:点击发送消息给对方17708515 点击发送消息给对方307742704 点击发送消息给对方287976517 点击发送消息给对方363783715
《中华人民共和国增值电信业务经营许可证》编号:川B2-20030065号