Magic Keyboard Battery Level

I am making an app for myself that would show the current state of the Magic Keyboard battery state. Can someone give me an hint or examples of what to do? Thanks.