概述
概述部分使用 @capgo/background-geolocation 当您的 Capacitor 应用程序需要在前台或后台获得精确的位置更新、iOS 和 Android 原生圆形地理围栏以及 WebView 被挂起时的后端地理围栏过渡时
核心功能
核心功能部分start- 实时获取前台或后台位置更新。stop- 停止正在运行的位置跟踪。openSettings- 当权限需要注意时,将用户转到原生位置设置。setPlannedRoute- 当用户偏离规划路线时,播放原生声音。setupGeofencing- 配置原生地理围栏的默认设置和可选的过渡 webhook 发送。addGeofence- 通过标识符监控 iOS 或 Android 圆形地理围栏区域。removeGeofence/removeAllGeofences- 停止监控已注册的所有地理围栏。getMonitoredGeofences- 列出当前由原生层监控的区域标识符。geofenceTransitionlistener - 在应用程序处于活动状态时接收进入和退出事件。geofenceErrorlistener - 处理原生监控错误而不改变过渡事件形状。
公共 API
公共 API| Method | Description |
|---|---|
start | Streams accurate foreground or background location updates. |
stop | Stops location updates. |
openSettings | Opens the device’s location settings page. Useful for directing users to enable location services or adjust permissions. |
setPlannedRoute | Plays a native sound when the user deviates from a planned route. |
setupGeofencing | Configures geofence defaults and optional native transition POST delivery. |
addGeofence | Starts monitoring a circular geofence on iOS and Android. |
removeGeofence | Stops monitoring one geofence by identifier. |
removeAllGeofences | Stops monitoring all geofences registered by this plugin. |
getMonitoredGeofences | Returns 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.ts 在 capacitor-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 企业插件替代方案