The code below is highly inspired by this answer and this answer, and I am trying to get it work with Kotlin language, rather than Java that was given in the answer there. It is basically based on JNA (Java Native Access), which essentially pulls the SYSTEM_BATTERY_STATE from the Windows Native library (on C++) to get information about the battery