locationManager.getLastKnownLocation() return null

后端 未结 5 1215
天命终不由人
天命终不由人 2020-12-16 13:32

i dont understand why locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); return the location null. I gave all permission but its reutning

5条回答
  •  执笔经年
    2020-12-16 13:47

    I had this exact same problem. It was because my device was not storing a last known location. I simply went on to Google Maps and pinpointed my location with GPS, then a value was returned for getLastKnownLocation()

提交回复
热议问题