simple_pedometer 0.0.1 simple_pedometer: ^0.0.1 copied to clipboard
Simple pedometer plugin for flutter iOS app. This plugin allows you to get pedometer data between to specified datetime on iOS.
simple_pedometer #
Simple pedometer plugin for flutter iOS app.
🚨 Warning #
This plugin is still under development and does NOT support android. If you want this feature on android, please consider another plugin for that.
Set up #
- Add
NSMotionUsageDescription
toiOS/Runner/Info.plist
<dict>
<key>NSMotionUsageDescription</key>
<string>Motion usage description</string>
</dict>
</plist>
Usage #
- Use permission_handler to handle MotionAndUsage permission.
- Use
SimplePedometer.getSteps
. It returns the pedometer data between the two specified DateTime.
final sensorsPermission = await Permission.sensors.request();
if (sensorsPermission.isDenied) {
return;
}
final stepsInLast4Hours = await SimplePedometer.getSteps(
from: DateTime.now().add(const Duration(hours: -4)),
to: DateTime.now(),
);
- ⚠️Caution: Only the past seven days worth of data is stored and available for you to retrieve. Specifying a start date that is more than seven days in the past returns only the available data.