J'ai un problème à faire un compteur de pas dans v3.x ionique, Ce codeplugin compteur étape donne erreur lorsque la méthode stop() appelé après la première fois
import { Stepcounter } from '@ionic-native/stepcounter';
startPedometer() {
if (this.buttonIcon === 'md-walk') {
this.buttonIcon = "md-man";
this.startbuttonDisabled = false
this.stopbuttonDisabled = true
let startOffset = 0
this.stepcounter.start(startOffset).then((res: any) => {
this.success("Started : " + res)
}).catch((err) => this.failure(err))
}
else if (this.buttonIcon === 'md-man') {
this.buttonIcon = "md-walk";
this.stopbuttonDisabled = false
this.startbuttonDisabled = true
this.stepcounter.stop().then((res: any) => {
this.count = res
}).catch((err) => this.failure(err))
}
}
ionViewDidEnter(){
this.stepcounter.getStepCount().then((res:any)=>{
console.log("---------counts-----------"+JSON.stringify(res));
this.count = res
})
}
Je reçois le texte suivant erreur
service not registered: [email protected]
S'il vous plaît aidez-moi. toute suggestion est appréciée. Merci.
Avez-vous essayé d'importer 'https: // github.com/ihadeed/cordova-plugin-stepcounter.git' au lieu de' https: // github.com/texh/cordova-plugin-stepcounter.git'? – Johny
Merci pour cela, mais j'ai effectivement abandonné l'idée d'utiliser le plugin stepcounter, car il ne supporte pas tous les appareils Android, de sorte que j'ai utilisé google fit api pour compter les étapes de l'utilisateur –