pedometer 0.0.5 copy "pedometer: ^0.0.5" to clipboard
pedometer: ^0.0.5 copied to clipboard

outdated

A pedometer plugin for probing the native pedometer. Works for both iOS and Android and is written in Swift/Java.

pedometer #

pub package

This plugin allows for conitnuous step count using the built-in pedometer sensor API's of iOS and Android devices.

Usage #

To use this plugin, add pedometer as a dependency in your pubspec.yaml file.

Example #

void setUpPedometer() {
    Pedometer pedometer = new Pedometer();
    _subscription = pedometer.stepCountStream.listen(_onData,
        onError: _onError, onDone: _onDone, cancelOnError: true);
}

void _onData(int stepCountValue) async {
    setState(() => _stepCountValue = "$stepCountValue");
}

void _onDone() => print("Finished pedometer tracking");

void _onError(error) => print("Flutter Pedometer Error: $error");

void _onCancel() => _subscription.cancel();
        

Configuring XCode for usage on iOS #

It seems that users of this plug-in will have to manually open XCode and configure a few settings manually, mostly pertaining to privacy settings and permissions due to the application collecting the user's movement data.

For usage on Android it seems there are no problems with permissions.

Common iOS Flutter Errors #

Fix: Enable @objc inference #

7jcq5

Errors only visible when running through XCode #

screen shot 2018-08-07 at 16 04 31

Fix: Configure plist and capabilities #

Step 1: Open XCode

Open the XCode project located at <your_project>/iOS/Runner.xcodeproj

Step 2: Set Capabilities

screen shot 2018-08-08 at 10 09 11

Step 3: Configure your plist

screen shot 2018-08-08 at 11 07 21

288
likes
30
pub points
96%
popularity

Publisher

verified publishercachet.dk

A pedometer plugin for probing the native pedometer. Works for both iOS and Android and is written in Swift/Java.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on pedometer