Get the battery percentage

This snippet will let you get the battery level percentage of the device.