This is something that can give you an idea of the OS you are working on, and not about developing an application that will work on any device, since you did not make an OS for them.
android, , , , . , .
, .
:
<receiver android:name=".ShutdownReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
</intent-filter> </receiver>
Action SHUT DOWN.
http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN