您的位置:首页 > 编程语言 > Go语言

Google glass GDK - 获取地理位置(经纬度)

2014-08-05 10:53 225 查看
与Android类似,直接贴代码~

LocationManager lm = (LocationManager) this.getSystemService(LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
double jingdu = location.getLatitude();
double weidu  = location.getLongitude();
double haiba  = location.getAltitude();
System.out.println("经度=" + jingdu + " 纬度=" + weidu + " 海拔=" + haiba);


最后添加权限:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: