首页 > 解决方案 > 无法在 android 模拟器上运行颤振计步器插件

问题描述

背景

我是新手,需要实现一个计步器。我找到了用于颤振的计步器插件,但无法运行示例代码。我正在使用视觉工作室代码和安卓工作室。我收到以下错误。

错误

E/flutter (11300): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: PlatformException(1, StepDetection not available, StepDetection is not available on this device)

I/flutter (11300): ERROR: StepCount not available

我已按照文档的说明在我的 androidmanifest 中添加了以下行:

<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION/>

任何想法为什么这不起作用?不能在安卓模拟器上测试计步器应用吗?我已经在像素 2 和像素 3 上进行了测试。

我有一部 Iphone,我正在使用 Windows 计算机,所以我无法在物理设备上对其进行测试。

标签: androidflutterpedometer

解决方案


推荐阅读