Skip to main content
Inspiring
July 10, 2011
Answered

Is there a task switch event for iOS? Like Event.DEACTIVATE for Android

  • July 10, 2011
  • 1 reply
  • 821 views

Hello,

I need to be able to trigger a function when someone presses the front facing button that has the square in it on an iDevice.

I've tried:

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, quitApplication);

This doesn't work on iOS but it does work on Android.

Anyone have an idea what to do?

-Scott

This topic has been closed for replies.
Correct answer boat5

Event.DEACTIVATE does work on iOS. However this does not work:

NativeApplication.nativeApplication.exit();

You can not exit an application on iOS. I'm guessing you might be trying this when calling your function 'quitApplication' ?

1 reply

boat5Correct answer
Inspiring
July 11, 2011

Event.DEACTIVATE does work on iOS. However this does not work:

NativeApplication.nativeApplication.exit();

You can not exit an application on iOS. I'm guessing you might be trying this when calling your function 'quitApplication' ?

Inspiring
July 11, 2011

I was trying that yes you are correct.

I did some experiments and found that my mistake was that I didn't have an event parameter to my function I needed to call.

I should have used the debugger before posting this thread. I would have found an error thrown.

Thanks for your help!

Participating Frequently
July 11, 2011

Hi,

If you want to exit the application on pressing the Home button, set the following in the iPhone section of application xml:

<key>UIApplicationExitsOnSuspend</key>

<true/>

Thanks,

Sanika