How to get current location in android 7?

前端 未结 2 649
梦谈多话
梦谈多话 2021-01-23 10:10

I\'m trying to get current location in android and its OK when i\'m using on android M or lower, But when i run my application on android N, location is null and when i want get

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 10:13

    To get the last known location all your have to do is call

    mLocationClient.getLastLocation(); once the location service was connected.

    read how to use the new location API

    http://developer.android.com/training/location/retrieve-current.html#GetLocation

提交回复
热议问题