Search code examples
androidalarmmanager

How to switch on the mobile devices programatically in android?


I am working on alarm clock and I want to check whether phone is switched on or off when alarm ringing on set time.

If phone is switched off then switch it on and ring the alarm.


Solution

  • Try this it may help you

    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>`