[ Do what you want/WW ]
[Android] locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER) 이 null을 반환할 때
2022-12-25 22:29:42
상황 날씨앱이다 보니 현재 위치를 받아와야 하는 것은 당연하다. 현재 위치의 좌표를 구하기 위해 LocationManager 클래스의 getLastKnownLocation 메서드를 이용한다. 그런데 해당 메서드가 Location이 아닌 null을 반환하는 바람에 현재 위치도, 현재 주소도 알 수 없어졌다. getLastKnownLocation(provider) Gets the last known location from the given provider, or null if there is no last known location. The returned location may be quite old in some circumstances, so the age of the location should a..