Getting null from 'getLastKnownLocation' on SDK

前端 未结 6 1367
星月不相逢
星月不相逢 2020-12-01 19:52

I have a problem related to the Location API.

I tried the following code:

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SER         


        
6条回答
  •  没有蜡笔的小新
    2020-12-01 20:57

    I had the same problem as you, I always receive a null Location object, But finally it was solved in an easy way. You must have a valid GPS location, so, if the GPS is not enabled and you dont't have enough signal, the Location object will be ALWAYS null.

提交回复
热议问题