0

Hi everyone and thanks for reading. I am using the Pedometer package (here https://pub.dev/packages/pedometer ) which is basically a step counter and am getting the following issue.

The Error

enter image description here

and my Android Manifest file

enter image description here

I am using the boiler plate code from github just in case the error was because of the code. https://github.com/cph-cachet/flutter-plugins/blob/master/packages/pedometer/example/lib/main.dart I have not been able to find a solution and any help is appreciated.

0

1 Answer 1

0

It's a permission issue hopefully was facing the same In documentation of the package you have to add

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

in adroid manifest

then you have to check for this permission before initializing the package

  if (await Permission.activityRecognition.request().isGranted) {
  _pedestrianStatusStream = Pedometer.pedestrianStatusStream;
  _pedestrianStatusStream
      .listen(onPedestrianStatusChanged)
      .onError(onPedestrianStatusError);

  _stepCountStream = Pedometer.stepCountStream;
  _stepCountStream.listen(onStepCount).onError(onStepCountError);
}else{
  
}
if (!mounted) return;

add the permissionhandler package and you should be good to go

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.