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:
- Created 4 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.