跳过内容

@capgo/background-geolocation

Capacitor应用的准确后台位置跟踪、原生地理围栏进入/退出事件和过渡 webhook。

使用 @capgo/background-geolocation 当您的 Capacitor 应用程序需要在前台或后台获得精确的位置更新、iOS 和 Android 原生圆形地理围栏以及 WebView 被挂起时的后端地理围栏过渡时

核心功能

核心功能部分
  • start - 实时获取前台或后台位置更新。
  • stop - 停止正在运行的位置跟踪。
  • openSettings - 当权限需要注意时,将用户转到原生位置设置。
  • setPlannedRoute - 当用户偏离规划路线时,播放原生声音。
  • setupGeofencing - 配置原生地理围栏的默认设置和可选的过渡 webhook 发送。
  • addGeofence - 通过标识符监控 iOS 或 Android 圆形地理围栏区域。
  • removeGeofence / removeAllGeofences - 停止监控已注册的所有地理围栏。
  • getMonitoredGeofences - 列出当前由原生层监控的区域标识符。
  • geofenceTransition listener - 在应用程序处于活动状态时接收进入和退出事件。
  • geofenceError listener - 处理原生监控错误而不改变过渡事件形状。

公共 API

公共 API
MethodDescription
startStreams accurate foreground or background location updates.
stopStops location updates.
openSettingsOpens the device’s location settings page. Useful for directing users to enable location services or adjust permissions.
setPlannedRoutePlays a native sound when the user deviates from a planned route.
setupGeofencingConfigures geofence defaults and optional native transition POST delivery.
addGeofenceStarts monitoring a circular geofence on iOS and Android.
removeGeofenceStops monitoring one geofence by identifier.
removeAllGeofencesStops monitoring all geofences registered by this plugin.
getMonitoredGeofencesReturns the identifiers currently monitored by the native layer.
addListener('geofenceTransition', ...)Receives geofence enter and exit events while the app is alive.
addListener('geofenceError', ...)接收到原生地理围栏监控错误时,应用程序仍然活跃.
getPluginVersion获取原生 Capacitor 插件版本.

此参考资料是从 src/definitions.tscapacitor-background-geolocation.

从 @capgo/background-geolocation 中继续前进

标题:从 @capgo/background-geolocation 中继续前进

如果您正在使用 @capgo/background-geolocation 来规划原生插件工作,连接它 使用 @capgo/background-geolocation 使用 @capgo/background-geolocation Capgo 本地能力目录 使用 Capgo 本地能力目录 Capacitor 由 Capgo 提供的插件 查看 Capacitor 由 Capgo 提供的插件 添加或更新插件 查看添加或更新插件的实现细节 Ionic 企业插件替代方案 查看 Ionic 企业插件替代方案