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
Regular Visitor
Posts: 1
Registered: ‎12-30-2010
My Device: Not Specified

Window not redrawn when minimized?

Hi there,

 

Is it possible for the window to be updated when the application minimized? I was hoping that the window would still be active, sort of like how a video keeps playing when it gets minimized, but when I minimize the window, it doesn't change anymore.

 

I guess the best way to explain is to show a sample program.

 

 

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.text.TextField;
	import flash.utils.Timer;
	import qnx.ui.text.Label;
	
	// The following metadata specifies the size and properties of the canvas that
	// this application should occupy on the BlackBerry PlayBook screen.
	[SWF(width="1024", height="600", backgroundColor="#aaaaaa", frameRate="30")]
	public class Test extends Sprite
	{
		private var counter:int = 0;
		
		public function Test()
		{
			var sleepTimer:Timer = new Timer(500, 0);
			sleepTimer.addEventListener("timer", timerHandler);
			sleepTimer.start();
		}
		private function timerHandler(event:TimerEvent):void {
			trace("wakeup!");
			
			//Remove previous text
			while(numChildren > 0){
				removeChildAt(0);
			}
			
			//Add new text
			counter++;
			var text:TextField = new TextField();
			text.text = counter.toString();
			addChild(text);
		}
	}
}

Basically, this program will increment a number and display it. But as soon as you minimize the application the text stops updating.  Yet the number does increment, as it will jump higher when you enter the application again.

 

So am I doing something wrong here, or does the window just not update when minimized?

 

Thanks for the help. :smileyhappy:

 

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

Re: Window not redrawn when minimized?

I see that behavior in my apps as well.  It appears that take a snapshot of the screen when minimzed (guess), because nothing updates, yet the application continues to run.  Hopefully, the next/final release of the SDK and simulator will make those screens live.

Developer
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: Window not redrawn when minimized?

It would be nice to know if this is just a simulator issue, or if you will have to do something special to keep the screen live when minimized.


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Window not redrawn when minimized?

[ Edited ]

@Ebscer, in one of the early videos I believe we heard that you'll be able to set one app as the "primary" video player and it will keep running even when minimized. 

 

In the Boy Genius Report demo video, we heard (near 3:30) that this ability will allow you to configure apps in some way to allow continued playing of audio and/or video.  

 

And in some other place, I read or heard that at least currently, AIR apps are reduced to 3 frames per second and any visual changes are not rendered when they are minimized. 

 

Lastly, I've seen pictures taken with presentation slides in the background showing bits of info about how QNX manages its viewports.  Some of that info suggested a clearly high level of sophistication and flexibility.  We've seen only the tip of that iceberg.

 

This seems yet another area where there is substantial power waiting to be revealed, but we have little choice but to wait for the next SDK and then start asking specific questions about whatever things are left unanswered at that point.  There may be much more to this than just some API setting that lets you say "myapp.updateWhenMinimized = true".


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!
New Contributor
Posts: 8
Registered: ‎06-03-2011
My Device: Playbook Developer

Re: Window not redrawn when minimized?

Maybe this would work. 

 

QNXSystem.inactivePowerMode = QNXSystemPowerMode.NORMAL; 

 

Here's the docs:

http://www.blackberry.com/developers/docs/airapi/1.0.0/qnx/system/QNXSystem.html#inactivePowerMode

http://www.blackberry.com/developers/docs/airapi/1.0.0/qnx/system/QNXSystemPowerMode.html

 

Also make sure you Application Behavior on your device is not set to Paused.