Battery

All,

Does anyone know if you can read and display the battery level in your project ? I know you can display time but battery level could be handy to allow users to save before a shutdown due to low charge.

@Bri_G The battery level sounded familiar, so I did a forum search and found this.

Simeon Admin Mod
September 2019 Posts: 5,714122.199.18.254

@dave1707 Oh I see the popover initially starts out very large, I'll look into that.

On device information, I've updated the deviceMetrics API for the next build to include batteryLevel and batteryState (as well as a few other fields)

@Bri_G Try this.

function setup()
    s=deviceMetrics()
    for a,b in pairs(s) do
        print(a,b)
    end
end

deviceMetrics() returns nil for me

@skar What were you running my above code on. I tried it on different iPads and an iPhone 8 and they all worked.

oh it’s because i ran it without the setup function, looks like it needs codea to be bootstrapped to work

Legit! Thank you for this! The most useful application for an in app battery life display I have encountered is that you don’t have to remove focus from the program to see the battery life. It’s HUGE in games especially multiplayer. THANK YOU