zepp-health / zml

https://zepp-health.github.io/zml/
Apache License 2.0
6 stars 3 forks source link

httpRequest error on AppService #10

Open miguelavh opened 1 week ago

miguelavh commented 1 week ago

Hi, I'm making an appservice and I want to make one httpRequest, When I start the time service (every minute make an httrequest) it fails, but I have added a notify and works so timeservice is working properly, but httpRequest doesn't work... But If I start the service and reboot watch, whe It start the time service comes to life, all works perfect, notify and httpRequest... It's like something has not been initialize properly... My watch is Amazfit Active with Zeppos4, and zml is 0.0.23... So a piece of my code is:

AppService( BasePage({ onInit(_) { timeSensor.onPerMinute(() => { this.getMetrics(); }); },
getMetrics() { this.httpRequest({ method: 'GET', url: endPoint, headers: { 'Content-Type': 'application/json' } }) .then((result) => { try { const status = JSON.stringify(result); }).catch((error) => { }); },
onDestroy() { //logger.log("service on destroy invoke"); }, }));

Please can you see what would be the problem?

Thank you very much.

Regards