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

Web and WebWorks Development

Reply
Developer
gyubok
Posts: 520
Registered: ‎10-08-2009
My Device: Bold 9900
Accepted Solution

onPause on BB10

What does this event actually mean? It doesn't seem to catch anything even though I add listener to it.

 

On Ripple, there's an option to fire an onPause event and it works well but doesn't do anything on an actual device.

 

What action fires onPause event on BB10?

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: onPause on BB10

Pause gets fired when the application is minimized and resume fires when the app comes back to the foreground.

 

See this sample code:

 

window.addEventListener("load", function(e) {
		document.addEventListener("webworksready", function(e) {
			if (blackberry.event){
				blackberry.event.addEventListener("pause", onPause);
				blackberry.event.addEventListener("resume", onResume);

			}
		})
	});

	function onPause() {
		console.log("The app is about to be paused.");
	}
	function onResume() {
		console.log("The app is resumed.");
	}

 

Tim Windsor
Open Source Technical Lead
Developer
gyubok
Posts: 520
Registered: ‎10-08-2009
My Device: Bold 9900

Re: onPause on BB10

What does it mean to get minimized?

 

On the PlayBook OS, there are four states an app can reside in:

 

1. Full foreground

2. Become "partially" minimized - swipe up

3. Become fully minimized - swipe up again and app screen is completely hidden from the user

4. App switched - swipe left or right to access another app screen

 

All of these are also accompanied by Showcase, Default, Paused in general option.

 

Which ones indicate that the app is "paused"?

Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: onPause on BB10

[ Edited ]

Hi there,

 

I tried to work with the events, on BB10 dev alpha packaging with PlayBook SDK at this time, using the blackberry.app.event.onBackground and blackberry.app.event.onForeground event handler to call some callback functionality. When going to standby mode (screen becomes black) the blackberry.app.event.onBackground event is fired and when coming back pressing the "on" button on the top of the device the blackberry.app.event.onForeground event is fired.

 

For me this is a completely missunderstood firing of those events since when I left the app in the background (not exiting) and open up eg. the browser app, my app in background should get an blackberry.app.event.onBackground event when minimizing it to open up some other apps or just go through all the apps running in "background" on the dashboard area (or how it is called). I think this should be completely reconsidered for the next stage of any OS update or SDK/Simulator in the future.

 

Regards.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: onPause on BB10

Hi

 

Probably you need someone from RIM to clear this up.

I'm not sure if this is related or not, but in the Playbook settings you can configure what happens to an app (pause, continue activity  etc) when you switch/minimize it. So the behaviour that makes this events get fired may depend on your own settings.

Again, this is just what came to my mind, I'm not sure about it :smileyhappy:

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: onPause on BB10

This thread starts to get really confusing when you start mixing BB10 and PlayBook and packaging with native for BB10 and packaging with AIR and running on both. Let's see if I can clear that up some.

 

The current UI flow in the homescreen on BB10 Dev Alpha is not the final design - it's Alpha and essentially the same as PlayBook. However, it will not remain that way so it's not really helpful to try and guess things from that.

 

Also, the PlayBook/Tablet OS naming of the onBackground/onForeground methods is a poor choice. They should have been called onPause/onResume like they are in BB10, since that encompasses the true use.

 

The onBackground or onPause method will fire when the application is paused. Under the typical settings on a PlayBook, this will occur when another application takes the foreground. The settings for "Application Behaviour" will change this to either fire the pause when the application is minimized with the "Paused" setting, or not firing if the "Showcase" setting is on. I can't really enumerate the way that it will work on BB10 until more details of the homescreen navigator are released. Today on Dev Alpha it runs like PlayBook.

 

The point of this method is to allow you to save user settings so that the user can return exactly to where they were, and to reduce resource usage, when the user switches to another task.

 

 

Tim Windsor
Open Source Technical Lead
Developer
gyubok
Posts: 520
Registered: ‎10-08-2009
My Device: Bold 9900

Re: onPause on BB10

@LBP thanks for clarification. This is what I was being confused about, really poor choice of name..

 

@twindsor Is the forum going to divide up between webworks dev for BBOS, PBOS, and BB10? I used to live in Java dev forum and things were very easy to find. The best part was everyone was on the same page all the time.. but I see fragmentation here.

 

I suppose the real reason for distribution of the alpha dev device to the developers is so that they can build games? I used to primarily build utility/productivity apps on BBOS that deeply integrated with the hardware + BBOS and was thinking of creating the same set of apps on BB10 but perhaps it is too early?

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: onPause on BB10

I don't think we'll be breaking up the forums. There are fragmentation points, but the vast majority of topics are all understandable to WebWorks developers.

 

You can do far more than games on the Dev Alpha today, though the WebWorks extensions are limited. If you are building with Cascades, the only way to see it on device is with a Dev Alpha. As WebWorks developers we can use a PlayBook to do more complete apps, and release them to market now, while we tinker with the Dev Alpha and try out the new APIs as they are released.

 

The next WebWorks SDK release for BB10 will add some new features that will really increase the value of having one for WebWorks development.

Tim Windsor
Open Source Technical Lead
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: onPause on BB10

Hi there,

 

for me, like explained in my previous post, onPause and onResume or in PB SDK onBackground and onForeground events should work when I minimize an app (and not close it) to eg. switch to another app and come back to the app later. I'm working on many other platforms for mobile devices and almost all of the throwing the pause event when app goes in background (not closed) and throwing resume event when coming back to the app to go on with it. So, hopefully, someone @RIM can think about it little bit since right now the PlayBook SDK for me only throws events when the screen/devices goes to standby or you leave standby, but this isn't quite to late for those events in my opinion and for the apps I'm working on.

 

PS: Looking forward to the new BB10 SDK and also to an update with some more functionality of the dev alpha as we have now with only the Browser app. There is a photo app, but it is useless since you are unable to see your pictures because of a missing app for this use case.

 

Regards.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
gyubok
Posts: 520
Registered: ‎10-08-2009
My Device: Bold 9900

Re: onPause on BB10

Thanks for answering my questions Tim!