Я пытаюсь использовать встроенный аптечку в приложении для трафаретов. Но здоровье всегда не определено.
Я использую конденсатор и stenciljs с собственными веб-компонентами.
Msg: TypeError: Невозможно прочитать свойство 'isAvailable' из неопределенного
У кого-либо еще былэтот вопрос?
import { Component, State, h } from "@stencil/core";
import { Health } from "@ionic-native/health/ngx";
@Component({
tag: "list-stats"
})
export class ListStats {
private health: Health;
componentDidLoad() {
this.health
.isAvailable()
.then((available: boolean) => {
console.log(available);
this.health
.requestAuthorization([
"distance",
"nutrition", //read and write permissions
{
read: ["steps"], //read only permission
write: ["height", "weight"] //write only permission
}
])
.then(res => console.log(res))
.catch(e => console.log(e));
})
.catch(e => console.log(e));
}
render() {
return [
<ion-label>
<p>Steps</p>
</ion-label>
];
}
}