小编mad*_*ddy的帖子

多久以前记录的最后一个位置?

我正在获取我最后一个已知位置,但不知道自我的位置上次更新以来已经有多长时间了.如何查看自上次更新位置以来已经过了多长时间?

LocationManager locationManager 
                        = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria c = new Criteria();
    c.setAccuracy(Criteria.ACCURACY_FINE);
    c.setAccuracy(Criteria.ACCURACY_COARSE);
    c.setAltitudeRequired(false);
    c.setBearingRequired(false);
    c.setCostAllowed(true);
    c.setPowerRequirement(Criteria.POWER_HIGH);
String provider = locationManager.getBestProvider(c, true);
Location location = locationManager.getLastKnownLocation(provider);
Run Code Online (Sandbox Code Playgroud)

java gps android google-maps geolocation

14
推荐指数
3
解决办法
5410
查看次数

标签 统计

android ×1

geolocation ×1

google-maps ×1

gps ×1

java ×1