Android GPS定位系统源码
2016-08-23
0 0 0
暂无评分
其他
如何获取积分?
一、LocationManager
LocationMangager,位置管理器。要想操作定位相关设备,必须先定义个LocationManager。我们可以通过如下代码创建LocationManger对象。
LocationManger locationManager=(LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
二、LocationListener
LocationListener,位置监听,监听位置变化,监听设备开关与状态。
private LocationListener locationListener=new LocationListener() {
/**
* 位置信息变化时触发
*/
public void onLocationChanged(Location location) {
updateView(location);
Log.i(TAG, "时间:"+location.getTime());
Log.i(TAG, "经度:"+location.getLongitude());
Log.i(TAG, "纬度:"+location.getLatitude());
Log.i(TAG, "海拔:"+location.getAltitude());
}
/**
* GPS状态变化时触发
LocationMangager,位置管理器。要想操作定位相关设备,必须先定义个LocationManager。我们可以通过如下代码创建LocationManger对象。
LocationManger locationManager=(LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
二、LocationListener
LocationListener,位置监听,监听位置变化,监听设备开关与状态。
private LocationListener locationListener=new LocationListener() {
/**
* 位置信息变化时触发
*/
public void onLocationChanged(Location location) {
updateView(location);
Log.i(TAG, "时间:"+location.getTime());
Log.i(TAG, "经度:"+location.getLongitude());
Log.i(TAG, "纬度:"+location.getLatitude());
Log.i(TAG, "海拔:"+location.getAltitude());
}
/**
* GPS状态变化时触发
java
源码
系统
定位
androidGPS
相关源码推荐
使用Java开发Android AOA Android开放式附件
0
0
暂无评分
VPN源码加速器
0
0
暂无评分
VPN源码
0
0
暂无评分
springboot校园招聘系统
0
0
暂无评分
java智能二维码门禁管理系统
0
0
暂无评分
暂无评论