Can ionic switch/power off android device?

Hi i am developing an app in a closed device and i need to switch/power off the device if power to the device is lost or disconnected. Is this possible, maybe using some cordova magic ?