×
Namespaces

Variants
Actions
Revision as of 17:00, 26 June 2011 by max.chen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

通过Cell-ID获取位置信息

From Nokia Developer Wiki
Jump to: navigation, search

This article explains how to get position via Cell-ID


C2系列手机介绍

2011年6月21日,第11届诺基亚年度盛会NokiaConnection在新加坡著名地标滨海湾金沙酒店(MarinaBay)开幕。会上诺基亚执行副总裁Mary McDowell发布三款C2系列新机C2-02、C2-03与C2-06。


“这三款手机都能够为消费者带来市场上一流的上网、地图和信息体验,还同时提供触摸屏和键盘两种选择,让操作界面变得更加简便易上手。用户还可以选择双卡或单卡版本,让这三款手机在同类产品中极具竞争力。”MaryMcDowell表示。

本次C2系列的产品组合包括双卡手机与单卡手机,触键双控,能够为S40用户带来全新的、先进的互联网与地图体验。三款手机均配有针对S40系列的全新诺基亚地图,预装当地地图和兴趣点。用户可以在离线的情况下浏览地图并规划路线,从而省去通过网络下载地图的成本。

600-nokia-c2-02 closed.png

诺基亚C2-02

JSR179 Location API

JavaME 规范中定义了JSR179 Location API。这个包中涵盖了大量的用于获取位置信息的类。


try {             
// TODO: Allow methods to be selected by the MIDlet and then used!
//MTA_ASSISTED Location method is assisted by the other party
//MTE_CELLID Location method Cell-ID for cellular
//MTY_NETWORKBASED Location method is of type network based.
int[] methods = {(Location.MTA_ASSISTED | Location.MTE_CELLID | Location.MTY_NETWORKBASED)}; // works
LocationProvider lp = LocationUtil.getLocationProvider(methods, null);
Location loc = lp.getLocation(-1);
Coordinates coords = loc.getQualifiedCoordinates();
lat = coords.getLatitude(); //double
lng = coords.getLongitude();//double
}
catch (Exception e) {
e.printStackTrace();
}
115 page views in the last 30 days.