1

It's possible detect event as volume button change or home button press when display is off?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1899125
  • 125
  • 1
  • 6
  • http://stackoverflow.com/questions/6259553/detect-when-volume-button-is-pressed. I took the contents of your question and put them in google, stuck "ios" at the end and I got this. – CaptJak Sep 02 '13 at 18:29
  • 1
    This solution is ok when app is running and display is on, but I need to detect the event when app is running and display is off – user1899125 Sep 02 '13 at 18:37
  • If you are able to run your app when the display is off, then you can receive notifications (volume change notifications) when your display is off as well. If your app can run, then it can run. If you add notifications for volume change in your app, then you get notifications. Are you able to run your app when the display is off? – CaptJak Sep 02 '13 at 18:45
  • Ok thanks for the help I thought that notifications continue to operate even in the background, still grace – user1899125 Sep 03 '13 at 07:31
  • @CaptJak I'm sorry but then how do they work applications such as runtastis (that with the locked screen every few minutes you informed about km, speed, etc.) or those applications that resting on the bed record the user's movements then creating a chart of account? – user1899125 Sep 04 '13 at 17:39
  • You misread my comment. You CAN receive notifications. Yes you ARE ABLE to. you just have to make sure that your application can run while the screen is off, that's all. If you can run the app when the display is off, then all features in the app will run as well (except for those which require the screen interaction). – CaptJak Sep 04 '13 at 18:04
  • ok I'm sorry, in fact I misunderstood your answer. ok but the problem is just to run the app display is switched off, everything I tried did not work for now – user1899125 Sep 04 '13 at 18:30

1 Answers1

0

In short, yes it is possible to detect volume change with notifications when your app is running in the background.

You need to make sure that your app is able to run in the background though, so that it will continue to work when the display is off. Many apps are already doing this (as you know) so there is no reason you can not do it.

If you are having problem running your app in the background, I suggest reading the Background Multitasking Guide. If you are still having problems, it would be best to open another question.

To answer this question: Yes, it is possible.

P.S. Pressing the home button when the display is off will turn it on ;)

CaptJak
  • 3,592
  • 1
  • 29
  • 50