2

I want to know whether we can get power off or on events in iphone. In other platforms like Android, BREW we will get a notification to our app saying the phone is turned ON. Is it possible in iphone?

Thanks Jithendra

Coder
  • 1,661
  • 4
  • 27
  • 50
  • 1
    Apple does not allow a lot of things to happen in the background... This is one of them. – Falcon165o Nov 20 '12 at 13:07
  • 1
    I'm afraid, that's not possible with iOS. You can only get notifications related to your app state. – Fahri Azimov Nov 20 '12 at 13:08
  • Thanks for quick reply. I guess no need to launch app and run in the background to get notifications like these. Atleast it is not required in BREW and Android. – Coder Nov 20 '12 at 13:09

1 Answers1

2

Short answer: no.

Your app isn't running on power-on, so there's nothing to notify. (A special case here would be apps registered as VoIP clients. But you still can't tell whether the handset just started or whether your app was killed for some other reason and then restarted.)

And when iOS shuts down it will send KILL signals to any background running tasks. You can't intercept them, so that doesn't really help you. (And even if you could, again, it doesn't say why your app is being killed.)

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • is this still true in 2021? I mean, is it still not possible to get some sort of notification when the user pressed the power-off button? – Keselme Apr 12 '21 at 11:13