腾讯定位 SDK 地理围栏请求类,封装了鸿蒙系统的 GnssGeofenceRequest。

Author

Tencent Location Team

Since

1.0.2

Constructors

  • 构造地理围栏请求对象。

    Parameters

    • geofence: TencentGeofence

      地理围栏信息

    • monitorEvents: GeofenceEvent[]

      监听的地理围栏事件列表

    • eventsCallback: AsyncCallback<TencentGeofenceEvent>

      地理围栏事件回调函数

    • Optional notifications: NotificationRequest[]

      通知对象列表(可选)

    Returns TencentGeofenceRequest

    Since

    1.0.2

Properties

geofence: TencentGeofence

地理围栏信息,包含圆形围栏圆心坐标、半径等信息。

Since

1.0.2

monitorEvents: GeofenceEvent[]

监听的地理围栏事件列表,数组长度不超过 3。

Since

1.0.2

eventsCallback: AsyncCallback<TencentGeofenceEvent>

用于接收地理围栏事件的回调函数。

Since

1.0.2

notifications?: NotificationRequest[]

地理围栏事件发生后弹出的通知对象列表。
notifications 与 monitorEvents 中的元素按下标一一对应,例如 monitorEvents[0] 为 ENTER,则 notifications[0] 为用户进入围栏时要弹出的通知对象。
该字段为可选:

  • 如果不需要在事件触发时弹出系统通知,可以不传该字段,仅通过 eventsCallback 处理事件。
  • 如果传入该字段,notifications.length 必须等于 monitorEvents.length,否则调用 addGeofence 时会抛出 GeofenceNotificationsLengthMismatch(880200)。

Since

1.0.2

Methods

  • 将腾讯地理围栏请求转换为鸿蒙系统的 GnssGeofenceRequest。

    SDK 内部使用。

    Returns GnssGeofenceRequest

    鸿蒙系统的 GnssGeofenceRequest 对象

    Since

    1.0.2