Weekend Coder: Dynamic active frames for your app

By Brian Scheirer on 28 Jul 2013 12:44 pm EDT

One of the unique new features in BlackBerry 10 is the the minimized view of an app, also called the active frame. By default it is a smaller version of whatever the app looks like when maximized, however app developers have the ability to change it. Not only can it be changed to a static view, it can also be dynamically updated from signals within the code. Both of these features seem to be under utilized in most apps I see in BlackBerry World currently. Maybe nobody knows about it or maybe they don't know how to implement it... Well that's about the change!

Few coding active frames facts:

  • Can be static or dynamic
  • For all-touch smartphones, the active frame is 334 pixels wide by 396 pixels high
  • For smartphones with a physical keyboard, the active frame is 310 pixels wide by 211 pixels high
  • A complete list of best practices when creating active frames can be found here.

Next, I've put together a video tutorial showing BlackBerry's stock example of the dynamic actives frames in action, then took it a step further and tied it to a QTimer to have the active frame update itself. I have added both the code for DynamicFrame and ActiveTimer to my CrackBerry Weekend Coder Github repository. One note that I did change the ActiveTimer JavaScript a little bit in the uploaded project to account for the timer stopping when hitting zero. As always feel free to sound off in the comments below with any questions.

Reader comments

Weekend Coder: Dynamic active frames for your app


Awesome, more devs need to utilize this feature!

I actually updated the active frame in my app to be dynamic with a QTimer a couple weeks ago for v2 :)

Posted via CB10

'What's On?', currently it's WebWorks but the Cascades rewrite is almost finished! :D

I actually took a different approach than in the video, my QTimer and all the logic is written in C++.

Nothing wrong with WebWorks lol.
You can do Active Frames in WebWorks apps too. I'll write up a how to one of these days :)

Nope, not at all, the WebWorks version has an active frame too :)

It just seems to be much more flexible in cascades ;)

Scrid, please do that writeup as a Web works amateur I would very much appreciate it. I have several of your apps and admire the work you have done and appreciate all you are willing to do to help other devs. If you do the write up and it's not published here would you let me know? Pin:2AB21E29



Thank you for the write up. I think it's great that you chose to focus on a very uniquely BlackBerry feature this weekend. Love the weekend coder series. Has been very helpful. Your work is very much appreciated

Posted via CB10

Most of my dev related stuff is on OpenSourceBB and in my Github. I'll do a writeup about active frames after the bar exam this week (I'll try to remember lol).
Sent you a BBM.

It would handy if there was an option in the phones settings so that instead of an active frame the app could remain fully running as a mini version and not pause or go into AF state.

Posted via CB10

Brian what do you think of active frames? Like them? What should BB do next? Kevin spoke his mind some time ago just wondering your take. Thanks

I think they are neat, but I don't think users or developers quite know what to do with them (myself included). As the platform matures we'll probably see users demanding some need for them and developers catering to those needs... Again not sure what it'll be.

Would be interesting to see some kind of ability to interact with them staying as an active frame. I imagine we'll see some interesting uses if that happens.

Posted via CB10

That's interesting because yesterday I was thinking how cool dynamic active frames look! I was listening to music with connected by HDMI to the big screen TV theatre and I also had the pictures app, BBM and CBC News minimized as active frames so the whole screen was being rendered on the Big screen TV. I thought it was so cool to have my pictures library scrolling through and messages from my kid and headlines from CBC Along with the scrolling album artwork all with easy access to respond to any one if them if I wanted to. I'm lovin' them!

From my sweet BB10 Neutrino powered Z10 :D

Yeah I agree, I love it when I have BBM and pictures active frames etc displayed at once, I actually wish the videos active frame was more active! Can't wait to see more dev's take advantage

QNX is the future

I wonder should it be like the playbook with a showcase mode for open apps. So if you want it to look good you leave it on or turn it off to save the battery.

I wish that was possible, I love showing people that feature on the playbook.
At least if the phone is plugged into power it should be able to do that

QNX is the future

I am not even a Dev but thank you all the same. Hopefully this will get utilised and my Q10 will be that little bit better.

Posted via CB10

Thanks once again for the tutorial. I really like your series, I told you before in other comments.
I for one like active frames. Dynamic content for the win!

Still waiting for the "from start to running app" write up of your tutorials, by the way ;)

Posted via CB10