Archive for category Devices
In November last year I presented at a QNX customer event in Stuttgart, attended by the top Automotive OEMs and suppliers. The event was great and it was clear that automotive is going to become yet another frontier for connected web technologies – what an exciting industy.
The QNX Neutrino OS is of course the underlying platform used by the Playbook as well as huge range of server, industrial and automotive products, all with “space-grade reliability”. QNX has of course shipped Neutrino in a huge array of different products in various configurations, making it one of the best choices for industrial, automotive, transport and consumer devices.
Interestingly, with the QNX Car, automotive OEMs can leverage Flash in a very unique way. Merging highly available OpenGL rendering with Flash components, and blended together using some special sauce. So with QNX Car, it’s possible to produce dashboards that are highly available and safe, yet dynamic and easy to produce in Flash. To enable this, the Neutrino OS employs a number of distributed processing techniques that ensure the safe running of key components – all while offering amazing multimedia and connectivity features.
Throughout 2010 we’ve all been thinking about the huge range of new devices, tablets, televisions and mobile phones that have begun to change the digital landscape. As part of my investigation into the automotive space, I started to think about the interactions between these devices. Do passengers want their tablet to be the control hub for their car of the future? What can we learn about our driving “expertise”, or green credentials using applications?
Imagine all of the opportunities for great integrated applications, think of all of the information at your disposal! We could have personalized and theme’d dashboards, mood sensors, and with 4G connectivity options on the horizon, we could see vast amounts of telemetry data help with the ever increasing congestion on our roads.
Well the good news is that the folks at QNX are already putting these concepts together. Let’s take a look at this demo shown at CES, integrating the RIM Playbook directly with the QNX car control systems…
One of the most common problems with Flash applications are memory leaks, programming flaws that cause Flash Player to loose access to memory that it could recycle otherwise. In the mobile space it’s crucial to understand memory management to get the most out of the Flash Player, and ultimately to ensure a smooth ride for your consumers.
Flash Player memory management
Flash Player makes use of automatic memory management, to help you to create applications with ease and with less code. In fact the Flash Player uses a pretty simple mechanism that determines how many times you have referenced a particular object. Once an object has nothing referencing it then it can be garbage collected – predictably it’s called “reference counting”.
The following is a great example of reference counting in action, notice that I have created a Geolocation object (geo) and added updateHandler as a listener function for update events. This counts as a reference against updateHandler:
var geo:Geolocation = new Geolocation();
The updateHandler function marks the geo object null, tagging it for deletion by the garbage collector which is great. The problem is that the geo object still has a reference to updateHandler, and therefore the geo object cannot be deleted until we remove the listener and free the reference up.
Memory leaks are easy to create in Flash, and even harder to debug later. It’s therefore essential to build your applications with memory in mind and use all tools at your disposal to keep checking for leaks, slow performance, and run away code.
Flash Builder Profiler
Flash Builder 4 ships with a new feature called the Profiler and in the video below I’ll show you how to use it to solve a memory leak. Now don’t be fooled, this memory leak took a few hours to solve in reality – these aren’t easy problems to solve.
In fact I found two memory leaks, the first is the ExternalInterface.addCallback holding onto a function reference. The other is more complex, and I have marked it “Flash Player Bug” as I believe this is a problem with the runtime itself.
I have just completed my App in a Week session on targeting Mobile and Devices, as promised, here are the source files for EVA on Android. So that you don’t get lost in the huge swathe of code let’s run through some of the features to get you started.
Target Multiple Screens:
The goal of this application was to target Android devices running AIR, or indeed the Flash Player running in mobile browsers. So it was important to include some pointers on how to dynamically layout the application.
I chose to implement two pretty simple examples of how to do this using the widgetComponent and the footerMenu. In the Application class I listen to the “Event.RESIZE” event through the doLayout function. As you stretch the SWF (use the standalone player) you can see the widgetComponent always displays in the middle, the footerMenu will always be at the bottom.
Of course the menu, widgets and background should all change dynamically. This won’t require a huge set of changes and as you can see it’s quite simple to control the layout. In a later build I will investigate a more dynamic approach to laying out the UI.
To demonstrate the data-centric features of Flash Builder, Mihai and Piotr created a database with PHP services that describe common Evangelist activities as well as data about us. In the mobile demo I have coded as few of these database interactions in the UsersService class:
- “UsersService.getByUsername” – Is used to login and returns an object with user details including their name, photo url etc
- “UsersService.setLocation” – Is used to store the lastest location after login, this is then synchronized with other Evangelists.
I have created a User object to represent the user of the service, this class also manages the loading of the user image using ContentLoader. The primary function of ContentLoader is to abstract the loading of SWF/image files, handling the various possible error cases.
An interesting new feature of Adobe AIR on Android is the ability to use the GPS hardware to get an accurate location fix. Although EVA was designed to run inside, or outside of the browser and as such I have built a few fallbacks.
In addition to these two approaches I have also deployed the MaxMind GeoIP service on my blog. This is a huge database of IP addresses that can be used to determine an approximate location, usually your nearest city. This is used when the application is running in standalone mode for debugging purposes, or as a failure fallback.
Using each of these methods I can reverse geocode the latitude and longitude to discover the users current location. The UI displays the current city and country. The open geonames database is an incredible free webservices that cover all manner of data, I couldn’t have wished for more.
One of the more interesting features of the application is the local weather service. There are only two services that can produce weather data for a give latitude and longitude, and those are Geonames and Google Weather.
I chose Google because it comes with the added bonus of providing a weather icon to display. Unfortunately this icon isn’t up to the quality of Serge’s design and so I ultimately swap it out, but at least I can easily change the URL.
- The stage is running in low quality mode – perfect for use with device fonts
- Layers have been minimized and flattened as much as possible
- The Frame rate of the application is 15FPS – as low as possible
- The EVA background is an 8KB PNG-8 128
- All other images are mobile optimized PNG-8 128 Dithered and under 4KB
- Bitmap caching is not used, the application is relatively static
- Special care has been taken to ensure that all assets are snapped to pixels (not 23.43 etc)
- No assets are loaded off stage and nothing is invisible, ever – if they are unused, then they are unloaded
- All assets use “Sprite” as their base class, as set in the properties panel in Flash Professional
- TLF is not used anywhere due to performance and size issues
- Only device fonts are used, they perform and render much better
- Flex is not used due to the overhead of the framework on devices.
In later blog posts I will discuss the Widgets in more depth, including the Social and Radar widgets. It’s also worth noting that Tom did a great job to deliver his P2P widget ready for integration, amazingly within 12kb!
We’re getting closer and closer to the launch of Flash Professional CS5, our Flash authoring tool ships with our Packager for iPhone preview. With the new tool it’s possible to create Adobe AIR applications based on Flash, and ship those on the Apple AppStore.
As you may have noticed, we have been shipping our own mobile applications for a while now, including Photoshop.com Mobile on Android, iPhone, Windows Mobile, and Acrobat Connect on the iPhone. In just these few short months we’ve managed over 6 million downloads already, and I’m looking forward to seeing future Adobe products on different form factors.
Of course some developer agencies have already been pushing out their first Flash-based applications using the pre-release packager. With over 100 in the AppStore today, I thought it would be interesting to have a look at the progress being made, enjoy the “presentation”
Although I’ve focused on the iPhone here, everything that you have seen can run on other platforms with a few tweaks. That’s the benefit of using Flash and AIR for your mobile and devices content.
Update: Kevin Hoyt shows some side-by-side demos with Android OS
As some of you know, learning about AIR, AS3, Flex, Flash Catalyst, Flash Builder has been my side-project for a few months now. As I mentioned in a previous post, it is essential to prepare for the future and invest now in learning new skills.
For me, the best way to learn new things is to create a project that’s difficult, yet cool enough to keep you interested. So my first few steps revolved around learning how to use Fireworks, then Flash Catalyst, Flash Builder and ultimately distribute an application using Adobe AIR.
One of the amazing new features of AIR 2.0 is the ability to embed and execute native code from right inside Actionscript, an API called NativeProcess. This means that you can safely run existing services over the command line, as well as install your own native service components. AIR 2.0 is in beta right now on Adobe Labs, and is mobile ready as designed so it’s a great time to get started.
So what would a Platform Evangelist for mobile and devices create?
What is it?
- A packaging utility that can produce SIS packages for Symbian devices
- It targets the Flash Lite 3.x runtime for Nokia’s S60 devices
- It runs on PC and Mac OS, all versions
- The tool has embedded Python binaries inside, compiled versions of “Ensymble“
- For signing purposes the tool also includes OpenSSL for certificate signing
- It is unsupported and without warranty
How do I use it?
How do I install it?
I have been hugely impressed with the capabilities provided by AIR, in this only my first AS3 project. Looking back on all of the technologies that I have used has really got me excited about AIR applications on Android, and even sprouted a few iPhone applications in advance of that. Seriously, imagine having all of the power of AIR and this toolchain on mobile phones?