question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pedometer not available soms phone (Samsung A40, Nokia 5.1)

See original GitHub issue

🐛 Bug Report

Environment

Android

Steps to Reproduce

Lance demo example (https://docs.expo.io/versions/latest/sdk/pedometer/) on Samsung A40 or Nokia 5.1

Expected Behavior

isAvailableAsync is returning true or false (but with the reason why is false)

Actual Behavior

isAvailableAsync is returning false. I don’t know why, there are no reason and no error. I can’t find the reason why is not available on theses phones

The code works fine on other smartphone like OnePlus 6T.

Code Example

import React, { useEffect, useState, useRef } from 'react';
import {
  Text, View,
} from 'react-native';
import { Pedometer } from 'expo-sensors';
import { styles } from './styles';
import I18n from '../../i18n/I18n';
import messages from './messages';

function PedometerComponent({ pedometer, setPedometer }) {
  let subscription = useRef(null).current;
  const [available, setAvailable] = useState('');
  const subscribe = () => {
    subscription = Pedometer.watchStepCount(result => setPedometer(result.steps), error => console.log(error));
    Pedometer.isAvailableAsync().then(
      (result) => {
        setAvailable(String(result));
      },
      (error) => {
        setAvailable(I18n.t(messages.podometerNoAvailable, { error }));
      },
    );
  };
  const unsubscribe = () => {
    if (subscription) { subscription.remove(); }
    subscription = null;
  };
  useEffect(() => {
    subscribe();
    return () => {
      unsubscribe();
    };
  }, []);

  return (
    <View style={styles.container}>
      <Text>{available}</Text>
      <Text style={styles.podometer}>
        {I18n.t(messages.stepCount.id, { stepCount: pedometer })}
      </Text>
    </View>
  );
}

export default PedometerComponent;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Tinkvisioncommented, Jul 9, 2020

Hello @jhowpaes,

Sorry I haven’t found a solution and in the meantime I’ve changed company so I can’t say if my successor has found a solution to the problem.

I had disabled the functionality on the devices that have the problem.

0reactions
github-actions[bot]commented, Feb 17, 2022

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My pedometer isn't working properly (Android only)
My pedometer isn't working properly (Android only) · 1. Phone Manager → Settings (top right) → Protected Apps → find Walkr → turn...
Read more >
Untitled
Big bun el paso phone number, Nrs hospital contact no. ... Boots ipulse not working, Save the arctic news, Como usar itunes 12,...
Read more >
Untitled
Not the perfect two chords, Unfall auf brennerautobahn, Jae sung jung usc, #Politica lgbt en bogota, Kopi luwak johor, Sidewalk prophets songs lyrics, ......
Read more >
Untitled
Posnet mobile wymiana rolki, Half moon nails how to do, San francisco fire mission ... Conmigo tu te sientes bien, Ugly people try...
Read more >
Untitled
Small bread roll calories, Social tv service not available! ... Oli kehrli lisa, Vlc media player for mobile nokia 5800, Fitzroy gardens visitor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found