TencentGeofence class

地理围栏。

映射来源

  • Android TencentGeofence.Builder(三形态:circle / polygon / district)
  • iOS TencentLBSGeofenceCircleRegion / PolygonRegion / DistrictRegion
  • Harmony TencentGeofence(仅圆形支持)

当某字段或事件在当前平台原生不支持时,addGeofence 不会抛异常, 而是忽略该字段并在控制台输出 warning(前缀 [TencentLocation])。 各字段的具体平台支持差异见对应字段注释。

注意expiration(有效期)在 Android 端应显式设置。SDK 对未设置 有效期的围栏按 duration=0 处理,会立即判定为过期并清理,导致 getAllGeofences 查不到刚添加的围栏。

Constructors

TencentGeofence.circle({required String id, required TencentLocationCoordinate center, required double radius, CoordinateType coordinateType = CoordinateType.gcj02, Duration? expiration, Set<GeofenceTransition> monitorTransitions = const {GeofenceTransition.enter, GeofenceTransition.exit}, Duration? dwellDuration, Map<String, Object?>? userInfo})
圆形围栏。
factory
TencentGeofence.district({required String id, required String keyword, CoordinateType coordinateType = CoordinateType.gcj02, Duration? expiration, Set<GeofenceTransition> monitorTransitions = const {GeofenceTransition.enter, GeofenceTransition.exit}, Duration? dwellDuration, Map<String, Object?>? userInfo})
行政区划围栏。
factory
TencentGeofence.fromMap(Map map)
factory
TencentGeofence.polygon({required String id, required List<TencentLocationCoordinate> vertices, CoordinateType coordinateType = CoordinateType.gcj02, Duration? expiration, Set<GeofenceTransition> monitorTransitions = const {GeofenceTransition.enter, GeofenceTransition.exit}, Duration? dwellDuration, Map<String, Object?>? userInfo})
多边形围栏。
factory

Properties

center TencentLocationCoordinate?
圆心。仅 typeGeofenceType.circle 时使用。
final
coordinateType CoordinateType
坐标系。
final
districtKeyword String?
行政区划关键字:adcode(如 "110108")或中文名称(如 "海淀区")。 仅 typeGeofenceType.district 时使用。
final
dwellDuration Duration?
停留事件的触发阈值。仅当 monitorTransitionsGeofenceTransition.dwell 时有效。
final
expiration Duration?
有效期。
final
hashCode int
The hash code for this object.
no setterinherited
id String
围栏唯一标识。
final
monitorTransitions Set<GeofenceTransition>
监听事件集合(enter / exit / dwell 任意组合)。
final
polygon List<TencentLocationCoordinate>?
多边形顶点(≥3 且不重复)。仅 typeGeofenceType.polygon 时使用。
final
radius double?
半径,单位米。仅 typeGeofenceType.circle 时使用。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type GeofenceType
围栏形态。
final
userInfo Map<String, Object?>?
自定义附加信息(随事件回调带回)。
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, Object?>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited