5

How would you detect if the user presses the volume hardware buttons and prevent default behaviour?

Thanks a lot.

phi
  • 10,634
  • 6
  • 53
  • 88
dan
  • 1,067
  • 3
  • 11
  • 17
  • 1
    Unforutanely, I don't have an answer, but be careful - most reasons for wanting to know when those buttons are pressed aren't good reasons and will get your app rejected. – MikeyWard Sep 15 '10 at 22:12

1 Answers1

10

Look at AVSystemController_SystemVolumeDidChangeNotification (or alternatively here)

Community
  • 1
  • 1
Matt S.
  • 13,305
  • 15
  • 73
  • 129
  • Thanks for your reply. Is there any way to prevent the default system behaviour? – dan Sep 15 '10 at 23:24
  • 3
    @dan - Apple does not allow you to override system behavior of buttons like that. There was an app that got in trouble recently for changing the behavior to take a picture instead. – Gavin H Sep 15 '10 at 23:41
  • @ghills - Thanks, I've read about this. But I don't need app store approval. It must work on my dev device, only. – dan Sep 16 '10 at 00:12
  • 12
    I want to emphasize that this is a private API call that will result in app store rejection, in case anyone comes by and sees the upvotes & marked answered on this answer. – Shaggy Frog Sep 16 '10 at 00:15
  • 1
    FYI, this notification also won't differentiate between hardware button presses and software on screen volume changes. – jarjar Jun 01 '13 at 00:55