Skip to main content
Inspiring
Jul 10, 2011 5:24 PM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
boat5Correct answer
Inspiring
Jul 11, 2011 12:57 AM UTC

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' ?

4 replies

boat5Correct answer
Inspiring
Jul 11, 2011 12:57 AM UTC

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' ?

Translate
Inspiring
Jul 11, 2011 2:15 AM UTC

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!

Translate
Participating Frequently
Jul 11, 2011 8:11 AM UTC

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

Translate