Search code examples
iosobjective-cnsnotificationcenternsnotifications

System Notification or any Delegate method for power button clicked - iOS


Currently I am working on a project where the app needs to catch the notification for power button click and send a message or something else to a specified address (may be a phone no). I have no idea is there any notification or something to catch the action of power button click. Please help.


Solution

  • No, there's no way of capturing specifically the press of that button.

    You get a notification when your app is backgrounded, but it can be backgrounded for other reasons, like the user pressing Home.