FlAMapLocation class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener({FlAMapLocationChanged? onLocationChanged, FlAMapLocationFailed? onLocationFailed, FlAMapLocationHeadingChanged? onHeadingChanged, FlAMapLocationAuthorizationChanged? onAuthorizationChanged})
→ void
-
添加回调监听
-
calculateLineDistance(LatLng startLatLng, LatLng endLatLng)
→ Future<double?>
-
calculateLineDistance
计算两点间距离 单位:米
-
coordinateConverter(LatLng latLng, CoordType from)
→ Future<CoordinateConverterResult?>
-
coordinateConverter
进行坐标转换
-
disableBackgroundLocation({bool removeNotification = true})
→ Future<bool>
-
仅支持android
关闭后台定位功能,关闭后台定位功能只是代表不再提供后台定位的能力,并不是停止定位,停止定位请调用
removeNotification - 是否移除通知栏, true:移除通知栏,false:不移除通知栏,可以手动移除
-
dismissHeadingCalibrationDisplay()
→ Future<bool>
-
仅支持ios
停止设备朝向校准显示
-
dispose()
→ Future<bool>
-
dispose
-
enableBackgroundLocation(AMapNotificationForAndroid notification)
→ Future<bool>
-
仅支持android
开启后台定位功能 注意: 如果您设置了target>=28,需要增加
android.permission.FOREGROUND_SERVICE权限,
如果您的app需要运行在Android Q版本的手机上,需要为ApsService增加android:foregroundServiceType="location"属性,
例:<service android:name="com.amap.api.location.APSService" android:foregroundServiceType="location"/>
主要是为了解决Android 8.0以上版本对后台定位的限制,开启后会显示通知栏,如果您的应用本身已经存在一个前台服务通知,则无需再开启此接口
注意:启动后台定位只是代表开启了后台定位的能力,并不代表已经开始定位,开始定位请调用
-
getLocation({AMapLocationOptionForIOS? optionForIOS, AMapLocationOptionForAndroid? optionForAndroid})
→ Future<AMapLocation?>
-
直接获取定位
-
headingAvailable()
→ Future<bool>
-
仅支持ios
设备是否支持方向识别
ture:设备支持方向识别 ; false:设备不支持支持方向识别
-
initialize({AMapLocationOptionForIOS optionForIOS = const AMapLocationOptionForIOS(), AMapLocationOptionForAndroid optionForAndroid = const AMapLocationOptionForAndroid()})
→ Future<bool>
-
初始化定位
-
isAMapDataAvailable(LatLng latLng)
→ Future<bool>
-
isAMapDataAvailable
是否是高德地图可用数据
返回true代表当前位置在大陆、港澳地区,反之不在。
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
startLocation({AMapLocationOptionForIOS? optionForIOS, AMapLocationOptionForAndroid? optionForAndroid})
→ Future<bool>
-
启动监听位置改变
-
startUpdatingHeading()
→ Future<bool>
-
仅支持ios
开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法
-
stopLocation()
→ Future<bool>
-
停止监听位置改变
-
stopUpdatingHeading()
→ Future<bool>
-
仅支持ios
停止获取设备朝向
-
toString()
→ String
-
A string representation of this object.
inherited