Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: NativeApplication.nativeApplication.exit() -- OK to use?


ElliotMebane wrote:
I was spurred to revisit this issue as a result of Terrence Ryan's recent blog post...

Note that the PlayBook is "smart" about this sort of thing.  By default, any app which becomes inactive is effectively frozen, neither rendering nor getting any CPU until it is activated again.  In effect, PlayBooks are automatically "tombstoned" (to use the term from Ryan's post) when they are deactivated.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

I want to add an "Exit" button to the title screen. So if a user clicks on the exit button should I then use this call?

 

NativeApplication.nativeApplication.exit();

 

Thanks.

Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

hmmm.. when I added the above exit call the app appears to just hang. Is there anything else I need to do? Perhaps prior to making this exit call? Thanks.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: NativeApplication.nativeApplication.exit() -- OK to use?

We use that and the app closes fine. Are you trying to do something else near the same time (e.g. save local data)?
Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

Hi -thanks for replying. Nope, all I'm doing is calling the exit function. Do I need to remove all event listeners first or some other house keeping I'm not aware of? 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: NativeApplication.nativeApplication.exit() -- OK to use?

You should not have to. I have seen it hang at times, but now I do not. Is there a reason why you need to do this instead of just allowing the user to exit the app from minimization?
Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

No reason, I've seen some other apps recently that added an exit button and I thought I would give it a try. One thing lead to another and now I just want to understand why it's not working. Thx.

Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

So....is anyone using this in their apps? If so, are you removing event listernsers, enter_frame, listeners before exiting? Thx.

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: NativeApplication.nativeApplication.exit() -- OK to use?

I don't remove listeners but I don't simply call ".exit".

 

I forget where I got the code, I want to say an Adobe sample but as I said I don't remember:

public static function exit(eventA:Event):void
{
	var event:Event = new Event(Event.EXITING, false, true);
	NativeApplication.nativeApplication.dispatchEvent(event);
	if (!event.isDefaultPrevented())
	{
		NativeApplication.nativeApplication.exit();
	}
}

 Haven't had a problem with it.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Highlighted
Regular Contributor
Posts: 82
Registered: ‎05-23-2011
My Device: Playbook
My Carrier: Developer

Re: NativeApplication.nativeApplication.exit() -- OK to use?

@rcmaniac25 - Thanks. Still doesn't work. I'm using FlashDevelop if that matters. I've tried everything I can. Very strange....