I want to do something at instant the user turns off android phone. How can my app detect it programatically?
http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN`
<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>