Example code to check battery status on Android