Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Displaying batteryLevel on watchface

ANSWERED

I want to Display batteryLevel on watchface.

I referred "https://dev.fitbit.com/build/reference/device-api/power/#".

But I can't it.

"undefined" on  my Console.

Is there a way to do it?

Best Answer
1 BEST ANSWER

Accepted Solutions

In order to use that you need to do the following:

 

import { battery } from "power";
myBatteryLabel.text = battery.chargeLevel;

I hope this helps 🙂

Barry Michael Doyle

View best answer in original post

Best Answer
5 REPLIES 5

In order to use that you need to do the following:

 

import { battery } from "power";
myBatteryLabel.text = battery.chargeLevel;

I hope this helps 🙂

Barry Michael Doyle
Best Answer

Have you put an appropriately named label in your svg? The example uses myBatteryLabel as a label id.

Best Answer

Sorry, I have very easy miss.

Variable name is "battery" to display batteryLevel.

So I changed this variable name, I'm successful!

Thank you so much!

Best Answer
0 Votes

Yes this as just an example of the relevant code. It's the same way you
would set the text of time.

Barry Michael Doyle
Best Answer
0 Votes

So glad you found it 🙂 It's a pleasure! Always great to help each other
😄 This forum is great!

Barry Michael Doyle
Best Answer