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.

1

There are 1 best solutions below

0
On BEST ANSWER

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