iosnotificationsmdmhome-buttonguided-access

Detecting home button press on iOS?


Is there any way to detect if the user has pressed the home button on iOS? Obviously if the app is running normally the app delegate methods gets called, but if the device is locked to an app (through Guided Access or an MDM-server) so the app doesn't quit when you push the home button - is there then any way to know if the user pushed it?

My initial thought was to listen for notifications, but I can't seem to see any generated by pressing the home button.


Solution

  • short:

    no not on a stock idevice

    longer:

    on a stock device your best bet is UIApplicationDidEnterBackgroundNotification (Posted when the app enters the background.)


    there is no dedicated way to listen for presses to the home button though, so this won't work for GuidedAccess either