GPS getLastKnownLocation 오류 메시지

694 단어
  getLastKnownLocation          ,      mLocationManager.getLastKnownLocation(provider);
             ,                 ,       
       ,    

private Location getLastKnownLocation() {
    List providers = mLocationManager.getProviders(true);
    Location bestLocation = null;
    for (String provider : providers) {
        @SuppressLint("MissingPermission")
        Location l = mLocationManager.getLastKnownLocation(provider);
        if (l == null) {
            continue;
        }
        if (bestLocation == null || l.getAccuracy() < bestLocation.getAccuracy()) {
            bestLocation = l;
        }
    }
    return bestLocation;
}

좋은 웹페이지 즐겨찾기