Example from pedometer package not working?

190 Views Asked by At

I have installed the blank flutter app with ONLY pedometer package :

dependencies:
  pedometer: ^3.0.0

And paste this source, compiled without errors, but in-app :

Step Count not available

I installed other libraries, they work, what's the point?

Flutter doctor:

[✓] Flutter (Channel stable, 3.7.5, on macOS 12.6 21G115 darwin-arm64, locale
    en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.76.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Device data:

Samsung Galaxy A10

One UI version
3.1
Android Version
11
Google Play system update
1 April 2021
Krenel version
4.4.17...

Chat GPT things:

The Flutter pedometer package should be compatible with the Samsung Galaxy A10 running One UI 3.1 and Android 11, 
as well as the Google Play system update from April 2021.
1

There are 1 best solutions below

2
Thusitha Deepal On

you should add , permissions to use the package,

For android:

For Android 10 and above add the following permission to the Android manifest:

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

For ios:

Add the following entries to your Info.plist file in the Runner xcode project:

<key>NSMotionUsageDescription</key>
<string>This application tracks your steps</string>
<key>UIBackgroundModes</key>
<array>
    <string>processing</string>
</array>