Android中实现GPS定位的简单例子

2019-12-10 20:01:22王旭
  • if (location != null) {  double latitude = location.getLatitude(); 
  • double longitude= location.getLongitude();  tv1.setText("纬度:" + latitude+ "n经度" + longitude); 
  • } else {  tv1.setText("无法获取地理信息"); 
  • }   
  • 这样子就能获取到当前使用者所在的地理位置了,至少如何下地图上实现,在下面将进行获取,并显示出来!对参考代码的人表示感谢!