Problems to get steps by Pedometer Api

Hi to everybody,

I’m triyng to get steps from device sensors but also if i correctly installed the librari expo-sensors i can’t get steps.

i have this json

{
  "name": "privatecoach",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@babel/runtime": "^7.21.5",
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/material-top-tabs": "^6.6.2",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@reduxjs/toolkit": "^1.9.5",
    "@shopify/react-native-skia": "^0.1.172",
    "@stripe/stripe-react-native": "0.23.3",
    "axios": "^1.3.6",
    "deprecated-react-native-prop-types": "^4.1.0",
    "expo": "~48.0.15",
    "expo-av": "~13.2.1",
    "expo-calendar": "^11.1.1",
    "expo-cli": "^6.3.7",
    "expo-dev-client": "~2.2.1",
    "expo-device": "~5.2.1",
    "expo-gl": "~12.4.0",
    "expo-image-picker": "~14.1.1",
    "expo-linking": "^4.0.1",
    "expo-mail-composer": "^12.1.1",
    "expo-sensors": "~12.1.1",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.4",
    "lottie-react-native": "5.1.4",
    "native-base": "^3.4.28",
    "react": "18.2.0",
    "react-native": "0.71.7",
    "react-native-base64": "^0.2.1",
    "react-native-calendar-strip": "^2.2.6",
    "react-native-calendars": "^1.1295.0",
    "react-native-circular-progress-indicator": "^4.4.2",
    "react-native-dropdown-select-list": "^2.0.4",
    "react-native-elements": "^3.4.3",
    "react-native-image-picker": "^5.3.1",
    "react-native-image-slider-box": "^2.0.7",
    "react-native-pager-view": "^6.1.2",
    "react-native-paper": "^5.7.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "^3.20.0",
    "react-native-svg": "13.4.0",
    "react-native-swiper": "^1.6.0-rc.3",
    "react-native-tab-view": "^3.5.1",
    "react-redux": "^8.0.5",
    "victory-native": "^36.6.8"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "typescript": "^5.0.4"
  },
  "private": true
}

And i used Api in this way

const getSteps = async () => {
        const isAvailable = await Pedometer.isAvailableAsync();
        const permission = await Pedometer.requestPermissionsAsync();
        setIsPedometer(String(isAvailable));
        
        if (permission.granted) {
          Pedometer.watchStepCount(result => {
            setCurrentStepCount(result.steps);
          });
        
      };
    }    
    
    useEffect(() => {
        getSteps()
    }, [])

Also if all permission are granted the function watchStepCounter returns nothing to me. Can someone help me?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.