static

int

GetBatteryLevel

()

SYSTEM_POWER_STATUS

status

if

GetSystemPowerStatus

status

==

||

status

BatteryLifePercent

==

255

return

return

status

BatteryLifePercent

Finally, complete the setMethodCallHandler() method added earlier.
You need to handle a single platform method, getBatteryLevel(),
so test for that in the call argument.
The implementation of this platform method calls
the Windows code written in the previous step. If an unknown method
is called, report that instead.

Remove the following code:

channel

SetMethodCallHandler

[](

const