LocationUtils

class LocationUtils
    author: Blankj
    blog  : http://blankj.com
    time  : 16/11/13
    desc  : 定位相关工具类

Types

OnLocationChangeListener
Link copied to clipboard
interface OnLocationChangeListener

Functions

getAddress
Link copied to clipboard
open fun getAddress(latitude: Double, longitude: Double): Address
根据经纬度获取地理位置
getCountryName
Link copied to clipboard
open fun getCountryName(latitude: Double, longitude: Double): String
根据经纬度获取所在国家
getLocality
Link copied to clipboard
open fun getLocality(latitude: Double, longitude: Double): String
根据经纬度获取所在地
getStreet
Link copied to clipboard
open fun getStreet(latitude: Double, longitude: Double): String
根据经纬度获取所在街道
isBetterLocation
Link copied to clipboard
open fun isBetterLocation(newLocation: Location, currentBestLocation: Location): Boolean
是否更好的位置
isGpsEnabled
Link copied to clipboard
open fun isGpsEnabled(): Boolean
判断Gps是否可用
isLocationEnabled
Link copied to clipboard
open fun isLocationEnabled(): Boolean
判断定位是否可用
isSameProvider
Link copied to clipboard
open fun isSameProvider(provider0: String, provider1: String): Boolean
是否相同的提供者
openGpsSettings
Link copied to clipboard
open fun openGpsSettings()
打开Gps设置界面
register
Link copied to clipboard
open fun register(minTime: Long, minDistance: Long, listener: LocationUtils.OnLocationChangeListener): Boolean
注册 使用完记得调用unregister需添加权限 {@code }需添加权限 {@code }需添加权限 {@code * }如果{@code * minDistance}为0,则通过{@code minTime}来定时更新;{@code minDistance}不为0,则以{@code * minDistance}为准;两者都为0,则随时刷新。
unregister
Link copied to clipboard
open fun unregister()
注销