flutter_activity_recognition 包使开发者能够检测和响应用户活动,如在 Android 和 iOS 设备上行走、跑步、骑车或驾驶。它利用原生平台 API 提供实时活动识别,非常适合用于健身追踪、导航应用和上下文感知服务。该插件轻量且可无缝集成到 Flutter 应用中。它支持后台活动监控,并提供事件驱动的更新,以实现高效的资源使用。
适合场景
健身与健康追踪
上下文感知的移动应用
智能导航系统
基于活动的分析
安全应用的驱动程序检测
主要特点
实时活动检测
跨平台支持(Android 和 iOS)
后台活动监控
事件驱动型 API
轻量且高效
适合对象
开发健身应用的开发者
需要用户上下文感知的应用程序
需要活动洞察的移动应用程序
涉及基于运动触发的项目
使用建议
两个平台都需要适当的权限
持续监控可能导致电池用量增加
受限于支持的设备硬件
可能需要在物理设备上进行测试
持续活动追踪的隐私考虑
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
This plugin is used to recognize user activity on Android and iOS platforms. To implement this plugin, Android used ActivityRecognitionClient and iOS used CMMotionActivityManager.
Features
Can request activity recognition permission.
Can subscribe to ActivityStream to listen activity in real time.
After adding the flutter_activity_recognition plugin to the flutter project, we need to specify the platform-specific permissions to use for this plugin to work properly.
:baby_chick: Android
Open the AndroidManifest.xml file and add the following permissions between the <manifest> and <application> tags.