Android GPS Location null

来源:互联网 发布:cpa刷量软件 编辑:程序博客网 时间:2024/05/16 10:09
private Location getLastKnownLocation() {    List<String> providers = mLocationManager.getProviders(true);    Location bestLocation = null;    for (String provider : providers) {        Location location = mLocationManager.getLastKnownLocation(provider);        ALog.d("last known location, provider: %s, location: %s", provider, location);        if (location== null) {            continue;        }        if (bestLocation == null                || location.getAccuracy() < bestLocation.getAccuracy()) {            ALog.d("found best last known location: %s", location);            bestLocation = location;        }    }    if (bestLocation == null) {        return null;    }    return bestLocation;}
原创粉丝点击