PhoneGap for Flex/AIR Mobile Developers

May 14, 2012By 51 Comments

If you’re a Flex/AIR developer or any developer focused on mobile for that matter, I believe it’s worth your while to spend some time reading this first post in a series of posts I will be writing on using PhoneGap (aka Cordova) for building mobile apps. It’s another great technology choice for rapid cross-platform mobile development and becoming more and more popular. I’ve heard some developers express how they feel like they’re going back in time with HTML/JS development, or simply don’t want to ‘go there’ but it’s worth checking out how it can be used to quickly build a mobile application with HTML/JS and PhoneGap and you should consider this option for building mobile apps.

What is it?

The crux of PhoneGap is essentially a big ‘ol .js file (per platform, separate one for iOS vs Android etc) along with some simple native code to enable it to work. In the main JavaScript file (phonegap.js or cordova.js) are a bunch of functions that give you access to native features including the camera, compass, accelerometer, file system, storage access, media capture, audio playback, notifications, contacts and network connection status etc, similar to what Adobe AIR APIs offer, with the addition of a couple more. You write your applications in HTML/JavaScript and use CSS to style them. PhoneGap apps are wrapped in a native web container component, which is why your HTML/JS/CSS work. This also means there is a dependency for your phone’s browser to be based on the WebKit engine. This really isn’t an issue though since WebKit is the default for iOS, Android, BlackBerry Tablet OS and webOS currently. A great overview of commonly asked questions about PhoneGap can be found on my teammate Andy Trice’s blog, as well as a bunch of other great PhoneGap posts, so definitely check out his blog for heaps of good content.

How Does it Work?

The API functions in the phonegap.js (or most recently cordova.js) files call native plugin/extension code to provide the access to the native features through JavaScript exec calls. If you’re an AIR developer, it’s similar to the AIR Native Extensions model, except in PhoneGap they’re called plugins, and the set of APIs listed above (notifications, compass etc) are included and set up for you by default in the PhoneGap download. There are a bunch of other open source plugins available too which can easily be added to your project, or if you don’t find one you need, they’re easy to write. Here you can find instructions on how to write one for Android, and here for iOS. You can see that the JavaScript exec calls for iOS use .h/.m files for the actual native implementation, and .java for Android.

When you’re ready to use one of the APIs in your application, it’s very straightforward and easy to use. Here’s an example of adding a notification to your application:

Code Example

...
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }
...

Here’s the result:

You will find that all of the APIs are accessed through a navigator variable (declared in the phonegap.js file). To see examples of how to use all of them, check out the nicely done API reference docs.

If you’re curious of how this works underneath, here’s the notification code snippet straight out of the cordova.js file (NOTE: remember phonegap and cordova are currently the same library, so if you download it now you may find that your main API files are named cordova.js file instead of phonegap.js):

phonegap.js Source for Notifications

...
/**
 * Open a native alert dialog, with a customizable title and button text.
 *
 * @param {String} message              Message to print in the body of the alert
 * @param {Function} completeCallback   The callback that is called when user clicks on a button.
 * @param {String} title                Title of the alert dialog (default: Alert)
 * @param {String} buttonLabel          Label of the close button (default: OK)
 */
Notification.prototype.alert = function(message, completeCallback, title, buttonLabel) {
    var _title = title;
    if (title == null || typeof title === 'undefined') {
        _title = "Alert";
    }
    var _buttonLabel = (buttonLabel || "OK");
    <strong>Cordova.exec(completeCallback, null, "org.apache.cordova.notification", "alert", [message,{ "title": _title, "buttonLabel": _buttonLabel}]);</strong>
};

The above code shows the notification alert function definition to use for performing a native alert notification on iOS. The important line there is the Cordova.exec(…) call, which will use the native plugin code for iOS or Java to perform the notification. If you’re extra curious and want to see what the native code looks like for this, you can open the Notification.java or CDVNotification.m files such as shown (note: you need to download the actual cordova/phonegap project source from github here to view the source files for the core plugins. This is only necessary if you wish to view them or want to make your own custom changes to them, typically you would just install from here). I pasted a couple snippets from the native code files below to give an idea:

Java Source for Notifications

public PluginResult execute(String action, JSONArray args, String callbackId) {
    PluginResult.Status status = PluginResult.Status.OK;
    String result = "";   
    
    try {
      ...
      else if (action.equals("alert")) {
        this.alert(args.getString(0),args.getString(1),args.getString(2), callbackId);
        PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
        r.setKeepCallback(true);
        return r;
      }
...

Objective-C Source for Notifications

...
- (void) alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
    int argc = [arguments count];

	NSString* callbackId = argc > 0? [arguments objectAtIndex:0] : nil;
	NSString* message = argc > 1? [arguments objectAtIndex:1] : nil;
	NSString* title   = argc > 2? [arguments objectAtIndex:2] : nil;
	NSString* buttons = argc > 3? [arguments objectAtIndex:3] : nil;
	
	if (!title) {
        title = NSLocalizedString(@"Alert", @"Alert");
    }
	if (!buttons) {
        buttons = NSLocalizedString(@"OK", @"OK");
    }
	
	CDVAlertView *alertView = [[CDVAlertView alloc]
							  initWithTitle:title
							  message:message 
							  delegate:self 
							  cancelButtonTitle:nil 
							  otherButtonTitles:nil];
	
	alertView.callbackId = callbackId;

	NSArray* labels = [buttons componentsSeparatedByString:@","];
	int count = [labels count];
	
	for(int n = 0; n < count; n++)
	{
		[alertView addButtonWithTitle:[labels objectAtIndex:n]];
	}
	
	[alertView show];
	[alertView release];
}
...

Common Questions

  • What kind of UI Components does PhoneGap offer? PhoneGap does not offer UI Components, they leave that implementation up to you with your choice of HTML/JS/CSS or some other UI frameworks available like Twitter Bootstrap, jQuery Mobile, Kendo UI etc…
  • How can I consume data in a PhoneGap app? The same way you consume data from a web application – REST, JSON, SOAP etc.
  • What’s the difference between PhoneGap and Cordova? Cordova is the Apache Open Source project behind PhoneGap. If this is confusing to you, please read this post!
  • What kind of development environment do I need? You can develop in your editor of choice on any platform. There are some workflow tips I can provide and will do so in the next post with my choices for editing, debugging etc. Once you have created your app in your platform of choice, you can just upload the source directly from your source control system or via zip file to PhoneGap Build as the screenshot below shows and it will create a ready to install package for all of the different platforms.

More Resources

  • PhoneGap Explained Visually
  • Debugging PhoneGap Apps with Weinre
  • PhoneGap Plugin FYI
  • Filed in: Adobe AIRCordovaFlex MobileFlex/AIRHTML/JSPhoneGap Tags:

    About the Author ()

    Comments (51)

    Trackback URL | Comments RSS Feed

    1. esDot says:

      I was hoping one of the last few evangalists talking about AIR, would begin to post about HTML… phew!

      Not enough HTML resources out there to learn from!
      /blatant sarcasm

    2. Keith says:

      Hi Holly. This is true “Evangelism”: preaching to members of another faith, and trying to convert them :-)

      Now seriously: it is a great idea and it is becoming more interesting every day, but I think a lot of this appeal has to do with how Air/Flex has become an uncertain platform (from a future support point of view) to develop with for enterprise applications. That the only Evangelist (you) that was mainly blogging about Air is no longer doing so is a clear (and sad) sign.

    3. James Loh says:

      I totally agree with the comment Keith.

      Now is Phonegap time, in our firma we investment in one medium Project with Adobe Air for Mobile. I’m a little be disappoint with that reaction for Adobe, with the future technology in the mobile platform. HTML, CSS and JS is okey, but actually those technologies have a lot of “Lukens” concerning Garbage collections, consistency, performance, debugging process and etc.

      Was all cool and better with Adobe Air for Mobile, but now what a sh…

    4. Mark Fuqua says:

      @ Keith. Agreed. Sad indeed.

    5. Frank says:

      What else is there to say about Flex? Everything there is has been said and blogged about already. Future development efforts lay in the hands of the Apache Flex team and till now, the hasn’t been much to blog about that might concern the masses.
      It’s not that Flex is dead (yet), you just have to take it as it is. Just because it doesn’t get future support from Adobe doesn’t mean you can’t use it any more.
      Personally, I’m very happy to see more and more Evangelists blog about PhoneGap as it looks very promising to me (being a professional Flex/Air developer myself). The HTML5 frameworks evolve rapidly and I’m already looking forward to start rolling my first HTML5/JS apps for mobile, though that doesn’t mean that my Flex/AIR work is going to stop in the near future.

    6. John says:

      I agree with the comments here. While I certainly have always appreciated Holly’s contribution to the Flex community, this sudden change raises doubt about why I should trust any development platform from Adobe much less their evangelists. This is not an attack to Holly’s integrity and/or skill. We must remember that she is an employee of Adobe and thus must follow whatever agenda they have set. The safest course of action is always to go native when developing mobile applications. Adobe should probably just stick to graphics and leave development to organizations that focus on it.

    7. Hi guys, thank you for your feedback :). I can understand your frustration. However, this blog is meant to be a technical blog with helpful tips and code samples etc to enable developers to be more productive in their daily jobs. To that end, I do work for Adobe, and think it’s important to ensure people are aware of the all the latest and greatest technologies Adobe is working with as well so they can make informed choices.

      Flex/AIR have always been near and dear to me, evident by this blog and my prior work and I’m really looking forward to seeing what comes out of Apache Flex in the future. I will continue to keep tabs on it and blog cool new features as I see them being something that appeals to a wide audience.

      I do feel like it’s also my job to help developers get up to speed with fun new technologies such as PhoneGap too though and others to come in the future, and will continue with that effort here as well.

      Thanks again :)!
      Holly

    8. Ihor says:

      PhoneGap not for Enterprise App! This is only for small mobile widgets or games. It’s nice in the tests and examples… but in real work you will have a lot of problems.
      1. extensions – not crossed and separeted projects for iOs and for Android (Java vs ObjectC)
      2. big problem with local database. WebSQL only for webkit but project depricated. indexeddb not for all devices and not sql-like :)
      3. security – i don’t think that naybody will build Enterprise App with thml+js !!!

      For now I don’t see any others ways to build high level Cross App w/o Flex/Air.
      For me PhoneGap i sonly like Web App but with offline functionality and no more.

      • Hey Ihor – I thought the same thing about enterprise apps, but lately, I’ve seen some that are definitely enterprise (large number of pages, complex forms, complex data viz, complex backend data interactions). You might be surprised at what you can build if you use a good MVC framework (backbone.js, knockout.js, etc.) and some proven design patterns.

        Also, PhoneGap abstracts the DB stuff – you can use the local database without the issues you mentioned — http://docs.phonegap.com/en/1.7.0/cordova_storage_storage.md.html

        Security is a frequent topic of discussion – but – remember, there are many enterprise web sites, therefore, it’s possible to build an enterprise-secure app in HTML/JS. It comes back to the design. Also, mobile devices have good sandboxing so that other apps can’t get to the data/code/app, and they have enterprise features such as remote-wipe, etc.

        However, to your point, it’s not perfect and it has a ways to go, but I’ve been surprised many times at what’s possible.

        Holly has been working on an internal app with other members of our team that will demonstrate some enterprise features. You’ll see more info soon.

        Thanks!

        Greg

        PS: By the way, you can still use Flex – it’s not going anywhere and works well today.

        • Ihor says:

          PhoneGap in real – emulator for WebKit? and webkit means that all like Web site.
          Html+JS nice and easy way for News portals, blogs, facebook and etc. If you need to delive information from any site or any portal to any mobile devices – PhoneGar is realy easy solution.
          But for Enterprise App and also for Game Developers this is no good way.
          As app – html don’t has SQL indexes, transactions, Sync, send big files to server, sockets, p2p. and etc.
          As game – canvas very slow way. Canvas wil redraw layers and all objects in each frame!!!
          Flash now has optimized functionality to redraw only layer with object. This like GIF vs AVI

    9. Ihor says:

      Question:
      if in the PhoneGap used HTML+JS as framework, why all moved to PG from AIR with same technology AIR+JS(jquery, mootols, sencha and etc)
      What is diff. for developers PG vs AIR for (html+js framework) and also what is diff. for uers and their devices.

    10. Mahoo says:

      Sad to see Adobe constantly push HTML5 instead of Flash/AIR but understandable.

      Just finished evaluating options for a cross-platform app, between AS3 AIR, a ton of HTML5 options and some other cross-platform frameworks (Lua, Ruby, Java… you’d be amazed at how many options there are).

      We really wanted to go HTML5 as we wanted to future-proof the app, but HTLM5 just isn’t there yet, both in terms of reliability and tooling (it’s bad enough on the web – trying to build a mobile app with it multiplies the pain a couple of times). AIR on the other hand provided everything we could have asked for (well, almost everything – we’ll have to make a few Native Extensions to get specific native capabilities as needed), the only problem is we don’t know when AIR will be killed for good, so it’s kind of a bittersweet feeling developing the app.

      Hopefully someday HTML5 will be as easy to work with as AS3/AIR…

    11. M Reale says:

      Some years ago I threw away (with some satisfaction) my Javascript and HTML books because I believed that current technologies were mature and productive. Now evangelists are saying that I must repent myself for that kind of heresy and we must go back to the past and work with the sadistic js/html combination. The sadly part is that we KNOW that the whole industry is moving towards this not because it is a better choice, but because some key players has said that this is better. And million of developers are not considered “key players” in this industry.

    12. Gilbert says:

      I am an experienced flex developer having a very hard time getting up to speed with HTML + Javascript + CSS. I got a couple of books and they are easy to follow, but then I looked at the tutorials about Backbone.js on Christophe Coenraets blog and I can not understand how to deal with that.

      Any one can point to a good workflow to get started?

      • Hi Gilbert, I’m actually in the process of working on some things to help out people just like yourself right now actually, specifically how to get started (workflow suggestions) and some starter templates for PhoneGap coming as well that should help a lot. Are you looking at using PhoneGap yet? Feel free to let me know your feedback on other things you might be looking for, and after you read what I put out this week. Thanks! Holly

        • AAA says:

          Hi Holly,
          same here with me, I am die hard Flex developer and now looking at the HTML5 and other stuff little sad, not sure how to go about it .. I did tried phone gap with AIR but now looking for pure HTML5 development will be great if you can help us.

    13. Paulus de B. says:

      We develop Flex/AIR applications connecting to LiveCycle DataServices, so you can imagine the disappointment on our side with what Adobe is doing with trying to force us to go the HTML/JS route.

      Having years of experience in enterprise development, I cannot take HTML/JS seriously.

      Please Adobe!

      • Hey Paulus – two things…

        1) Flex is still alive and well and being used by many. There is no reason to abandon that path. Nobody is forcing you down any path.

        2) I felt the same way about HTML/JS, but the more I learn, the more serious I take it. This isn’t the JavaScript that we were all hacking a few years ago. There are good frameworks and some really great apps to prove that it’s doable.

        I recommend that you stay the course with Flex/LCDS, but slowly start getting your feet wet in real HTML/JS.

        One thing I’ve learned in 25 years in this industry – never ignore the big trends. Trending always wins, regardless of which technology is better. HTML/JS is trending at an amazing pace.

        Greg

        • Paulus de B. says:

          Hi greg,

          Thanks for you reply, it makes sense.

          We however never look at what’s trending, only if ‘common sense’ applies to the technology and what it can do for our clients and ourselves. ‘Trending’ technologies don’t necessary deliver (e.g. SOAP etc.).

          And looking at the power of the Flex/AIR/LiveCycle combination: it just rocks.

          And mind you, we pay big money for the Adobe LiveCycle licenses (data services and process management) and since Flex is still recommend for enterprise development a little loyalty from Adobe’s side to Flex would be nice (understatement). But nowadays, go to any of the Flex guru’s blogs and they all switched to HTML/JS.

          So yeah, somehow I’m left with a feeling of disappointment about Adobe.

          Paulus.

          • Paulus – those are very valid points. I think you will see more blog content for Flex once Apache ships their first version (soon), but until then, just like you, we’re trying to become experts as fast as possible.

            I also expect some of the active Apache Flex guys to start blogging more about it soon as well.

            SOAP is a great example of hype that didn’t ever really deliver, but I’m seeing really solid enterprise-class apps being built with html/js, so I’m hopeful.

            Thanks for the dialog – it’s really appreciated. Either way, it’s not a good situation for many, and to be reallu blunt, Adobe fumbled the communications related to Flex/LC/etc. :-/

            Greg

    14. Gilbert says:

      Hi Holly. I haven’t looked at PhoneGap yet. I have been trying to understand Backbone.js, but I need to know how to start from simple things and work my way up from there.

    15. Ihor says:

      I love Flex/AS3.
      A week ago, I have been trying to made offline appp in PhoneGap+JS.. but still don’t und. how to solve problem with DB and Files.
      For example:
      you have app like simple TaskManager, but in each item you can attach few images or few Doc files. Than later you must to sync all data to remote server, and also update local database.
      This work god for Flex(sqlite)+AMF(mysql) but i think this is impossible in PhoneGap+JS or need a lot of hard work.

      My think: HTML5 good for Web Mobile App, or simple offline like Twitter client. For the strong Enterpise App we still can do it as native (java) or as AIR+Flex.

    16. So as far as I can tell from this very insightful conversation, Adobe wants us to write in PhoneGap/Cordova for AIR?

      It’s been very frustrated trying to find anyone discussing HTML/JS development for AIR.. It’s almost like no one is doing it!

      There are 0 books on the subject which is always a bad sign.

      I thought AIR was the cross-platform panacea that the entire corporate world had been waiting for, now i’m not sure wtf is going on!

      Thank you Holly for all your efforts in keeping us up-to-date with AIR!

      • Hey Chris – AIR isn’t really part of what we’re showing these days. PhoneGap is a open source framework that provides a container and bridge to native capabilities of the device. AIR is not needed.

        It is possible to use HTML/JS to build apps in HTML/JS, but it’s independant of PhoneGap.

        There are many books and tons of articles on PhoneGap. A good starting place is http://phonegap.com

        AIR is still very relevant and being used by many. Most people are using AIR to deploy apps built in Flash or Flex.

        Greg

        • Ihor says:

          …and finaly – What diff. in Air and PG?
          Both way made native app with html/js code. Both cross app framework.
          For now the Air has all needes tools and libraries and also integrated sqlite. In same time Adobe try to change way near PG. Why?

          • Ihor, you need to dig a little deeper on phonegap.com. It has sqlite support. PhoneGap also has support for far more devices including Windows phone, older iPhones (AIR doesn’t support pre-3Gs models), and many other platforms.

            AIR is a more complex “wrapper” for HTML/JS code which you may or may not need. PhoneGap is a much smaller footprint and has a much faster load time.

            Greg

    17. Sean says:

      If you’re serious about Open Source and what’s best for the community, make AIR and the Flash Player open source !!!

      The one thing that can and probably will stop Apache Flex from being successful is that its useless without these proprietary pieces of other technology.

      Everyone has completely lost trust in Adobe and they control these vital 2 pieces of the puzzle. So, who’s going to invest in Flex development when Adobe could drop both at a moment’s notice.

      So, stop trying to push this html/js crap down our throats. “more and more people using it ?”, you wish, coz you bought it Adobe. Now you’re praying someone’s gonna use it.

      • Sean – nobody is cramming anything down your throat. Why don’t you simply stop reading our blogs if that’s how you feel. Holly is doing an amazing job (as always) and you’ll see more and more HTML/JS content from her in the near future, so get used to it. It’s her job! If you don’t like it, stop reading it!

        Meanwhile, we’re getting the most blog traffic we’ve ever seen and seeing amazing excitement in our efforts in web standards. Have you looked lately at how Adobe is starting to put massive efforts into making HTML better? Check out CSS Regions/Exclusions/Shaders/Compositing/Filters/etc. — http://html.adobe.com – and that’s only a fraction of the efforts. PhoneGap is doing extremely well – with much more acceleration than we ever saw in prior mobile technologies, including Flex.

        I hear you on open sourcing flash/air. It sounds like a great idea on the surface, and many of us have pushed hard for it to be open sourced, but we quickly learned that it’s not as simple as posting the source. There are complex IP issues with a lot of OEM technology and a ton of work that would need to be done to make it a successful open source project. The effort would be massive, and the company has decided to focus on web standards instead. Do you think it’s wrong to bet on technology that is trending upward (rapidly)?

        Meanwhile, Flash isn’t going anywhere anytime soon. It’s wildly popular in gaming and premium video (where Adobe has decided to focus it’s Flash efforts). Surely you’ve seen the continued innovation with Flash Player, right? More is coming. As a side effect, Flex can continue to rely on Flash Player …so relax!

        By the way – the number of people using HTML to build mobile apps is massive and growing at an accelerated pace. You can pretend that Adobe is making it up if you want – but we’re seeing the real excitement as we go to events and see the excitement across the developer world.

        Greg

    18. Bob Sutton says:

      I have 25 years experience in building software using all kinds of different tech. HTML/JS in all its forms, was, is and will remain a fundamentally inferior way of developing enterprise scale, OOP, data and media rich applications. It just doesn’t cut it and I am astounded by the flannel of people who seem determined to try to convince everyone that it does. We have to be realistic and it sure seems like everyone at Adobe has decided to sell out and go with the herd. But you know what? Try writing a sensible app integrating an array of 48 inch touch screens with web services, iPads as consoles plus a games server using JS. Then try doing it in two weeks. Phone gap is an interesting option for slight developments comprising essentially packaged web pages. I can’t see how it’s a lot of use for anything more than that really. Adobe should start listening to their loyal customers and stop fawning over iColyte brigade for five minutes – I am with the majority here in wishing that Adobe evangelists would get back to their job instead of leaving it to their increasingly beleagured and bewildered customers.

      • Bob – have you taken the time to see what’s possible in HTML/JS in the past year? With modern frameworks and modern browsers, you’d be amazed. Of course it’s not perfect and it has a lot of shortcomings compared to Flex, but it also has a lot of advantages.

        This comes down to one simple decision…. Does we evangelist try to promote a technology that is simply not getting traction (Flex) or do we try to take the rapidly trending technology (web standards) and make it better and help people use it to build real apps?

        You state above, “I am with the majority here in wishing that Adobe evangelists would get back to their job instead of leaving it to their increasingly beleagured and bewildered customers.”

        You are NOT with the majority. You might be with the marjority of people that are building Flex apps today, and I totally understand that….BUT… the majority of developers worldwide are moving to open standards. Like it or not, it’s fact.

        Bottom line: This IS our job and you’ll see more and more from us and we are seeing incredible praise for it – MUCH more than we ever saw prior.

        Don’t get me wrong – we had a lot of pain and emotion when our management decided to move away from Flex, but at some point, you have to move forward. Surely you’ve seen other events like this in your 25 years. I’ve also been in this field for 25+ years and I’ve seen it over and over. It’s just how technology is.

        Keep using Flex – it has new life and is doing well in Apache. Adobe will keep adding new features to Flash Player for the foreseeable future, but you should also hedge your bets a bit and check out some modern html/js frameworks and design patterns. You might be as surprised as we were.

        Thanks!

        Greg

    19. Bob Sutton says:

      Hi Greg. Yes, in 25 years, I have seen a lot of other great technologies fall by the wayside as the result of corporate backroom deals and knee jerk reactions to market trends. The point about evangelism though, is that you need to keep faith – providing of course that the faith is not misguided.

      You help give something traction by pushing it, not by abandoning it. My clients are coming back to me again and again for AIR apps and the more people who hear about and use it, the more that will be the case – we need Adobe to get behind their own brilliant technolgies and support them.

      Of course I have checked out JS frameworks, tools and patterns – JQuery, Dojo, ExtJS, MooTools and others – Jquery is clearly ‘trending’ better than anything right now so to follow your own logic I guess it must be the best (catch the irony?). See here : http://www.google.com/trends/?q=jquery,dojo,mootools,yui,extjs

      However compared to AS3/Java/C# etc, JQuery code is just plain clumsy. The event model is poor. OOP is sketchily implemented – the frameworks do their best to patch this, but ulitmately fail. Debugging is a nightmare, data typing is rubbish, there are too many layers of code and of course it can’t be compiled.

      Far from being amazed, developing in this kind of environment feels like my hands are tied. Worse actually. It’s like wallowing around in some kind of steam punk nighmare with everything held together with tape and wires. Nothing works properly unless there is an R in the month (and without some caveat about this, that or the other browser)Documentation? Why waste time on that? I could go on but I can’t be bothered, really. There is simply no contest.

      Oh, yes, – it’s all a bit new, we’re told – but it will get better in some unscheduled rosy future. Meantime please just accept that we’re all moving that way and sit back whilst we pull the struts out from beneath the mature, stable, professional, documented and thoroughly brilliant development platform you’ve invested in. Pardon my irritation.

      I am heartily sick of hearing how amazing this or that HTML5/JS site is, and then going along to see something which could have been put together in Flash ten years ago in about half an hour with practically no code.

      Since there’s apparently no alternative I will have to deal with this mess like everyone else, but I still say that you guys ought to be a heck of a lot tougher about protecting your territory. The web is being dumbed down as a delivery platform – hey, ho, so what that was probably inevitable. But why complete the damage by apparently supporting PG over Air?

      In the last two weeks I have used AIR to build an expenses tracking app which runs on iOS and Android leveraging Facebook and Twitter APIs, database, geolocation and the camera. It runs perfectly, responsively and smoothly on both platforms and looks peachy.

      As in any other ecosystem, diversity has to be balanced against survival of the fittest – but tools are key and you are the custodians of people’s careers, livelihoods, and futures.

      Just because something is ‘trending’ doesn’t make it the best – it just means it’s trendy. After 25 years you should know how long lived trends are. In a few years time when the tablet and mobile markets mature and iOS devices look about as smart and cool as those first brick-like car phones (or perhaps the Apple Lisa), we’re going to need great technologies – and Flex and AIR ought to be right up there.

      • Paulus de B. says:

        +1

      • Two things:

        It’s more than just trending — we get more hits on PhoneGap.com in a single day than we ever received in a month on Flex related sites and it’s accelerating at an amazing exponential pace.

        Flex is awesome – and many of us fell in love with it because of the speed and elegance. But honestly, it was damn near impossible to acquire new developers in the current climate. Right or wrong, that’s the facts. It was the obvious right business decision to switch gears (as much as the reality of it sucks). Yes, open sourcing flash player would have helped, but as I mentioned above in another response, it’s not as easy as it sounds (and still has a lot of risks). Web Standards is simply winning.

        RE: Frameworks: The frameworks you mention (JQuery, Ext, Dojo, etc.), are mainly DOM manipulation frameworks. I’m talking about MVC frameworks like backbone.js, angular.js, knockout.js along with templating, etc. — these things that make JavaScript less “duct tape-like”. If you haven’t looked at these frameworks, you’re missing some exciting stuff that’s happened to JavaScript in the past couple of years.

        Once you get into this level of tooling and you master the language specifics (no matter how bizarre), you’ll find that you’re nearly as fast as Flex. I’ve seen it happen and have heard many developers admit it. I’m not saying that JavaScript is as good a language as AS/Flex (no doubt!), but with the right frameworks/tooling, you can do really well.

        One last note — HTML5/web standards is more than just trendy. When you take the time to really take a deep look at what’s going on with the various specs and innovation, you’ll see that it’s some huge efforts under way and a lot of entities behind them. Web standards is actually moving forward faster than ever (shockingly). It’s not something that’s going to fade away in the next few years. The infamous “trough of disillusionment” that comes with most technology trends is simply not happening. The momentum and adoption is accelerating.

        Believe me, I was in as much denial as you and just as frustrated. But, it suddenly became our job to deal with it and move on. Not an easy task!

        Personally, I wish Adobe would have continued to also invest in Flex while it invested in web standards, but at the end of the day, it was just simply not worth the investment needed. Hopefully the open source community will provide it the right investment. So far, the early signs are VERY good with Apache Flex.

        Don’t hate us for moving on. It’s our job. Holly and others had to shift and although it feels like abandonment to some of you, consider what it’s like to be in our shoes. We had to not only shift technologies, we had to become guru-level in a near impossible time-frame.

        It is what it is :)

        Thanks for the debate – I hope you don’t take any of this personally. I’m just trying to help you guys understand some of the reality of what’s going on with the decisions Adobe made.

        Thanks!

        Greg

      • Great writing, Bob! I’ve also had experience coding with fastest js UI library (jqMobi) and then compiling with PG. Development wasn’t particularly exciting, final application isn’t just comparable to what I was able later achieve with Adobe Air.

        If I’d wanted to have coverage for all platforms (desktop and mobile), I’d actually rather use Haxe then PhoneGap.

    20. Ihor says:

      I see that: now time when Flex/Flash die but HTML5 still not born.
      Flex/Flash has very big exp. and very big community. A lot of code, libs, components. Also Flex has a lot of features integrated, for eny enterprise development.
      What about HTML5… I tried to write Enterprise App and Few Games on HTML5… Flex has all internaly, but for HTML5 I need to loss a lot of hrs to read all forums and blogs, try to find a lot of externals libs and codes. I still can’t choise any Framework and write my code. I can’t choise andy JS framework to write my game… I need to solve puzzle before, and use 5-7 libs min. and add own very big code.
      As I say before… Flex is die but HTML5 still not born.
      I can still use Flex, but I need to see in next few years> and try to move from Flex to HTML5 at now… but I see that it’s wrong time for this and we need goto back for 5-10 years and write from 0 and made all old path but now for HTML5 by self :( … bad time.

    21. Bob Sutton says:

      Ihor. The good news is that not everybody in Adobe is abandoning ship and I suspect this argument is far from over. I am entirely in agreement with you and so are many serious developers of games and applications. There are plenty of people who are dismayed by the fundamental shortcomings of JS as a platform for serious development.

      Perhaps a new language like Google’s Dart might eventually help – see here – http://www.dartlang.org/ It’s in its infancy but does at least have basic, fundamental things like proper closures, extensible classes, lexical scoping, static typing etc. and purports to provide a integrated developing and debugging experience. Of course it’s output is HTML5/JS but who cares, provided you can maintain your source code and sanity. Then there’s GWT which allows you to develop in Java and compile out to HTML5/JS – and there’s a phone gap plugin for that too.

      My guess is that Phone Gap and these emerging but as yet unfinished MVC frameworks will take over the mantle for HTML styled phone apps – and why not? Horses for courses I say.

      But those of us who require a more robust, controllable, extensible and above all OOP compliant environment will stick with Flex/AIR and move into technologies like Java, C# etc – and trust me it is not for nothing that Java remains the highest paid, most desirable skill in IT.

      AS3 is a fantastic platform for professional development and it is sad that Adobe, or at least certain factions within it seem to be naysaying it. Flex will continue under Apache who are a force to be reckoned with too and I suspect understand very well what a fantastic resource they have.

      Adobe has pledged continued commitment to the Flash platform and there is simply nothing to come remotely close to Flash/Flex/FB/Starling and Stage3d etc as a rapid development platform for games for desktop browsers and distributed under AIR.

      Many large companies have huge resources invested in Flash – one of my clients has over £2million worth of learning materials as Flash assets. They are currently trying to port some of these to HTML5 using the best on the block – but the results for them have been nothing but frustration.

      However, as yet none of their blue chip clients are queueing up for the flaky, dumbed down stuff which is possible using web standards at the moment – they prefer to remain with the Flash version which works beautifully, seamlessly and delivers a responsive and common UX to the desktop which is exactly where they want it most of the time.

      I wouldn’t worry overmuch – it may seem like bad times, but actually the really big stuff keeps going and there are plenty of people with huge vested interests in keeping Flex alive.

    22. Greg Steele says:

      My company has been developing microsoft based applications for 15+ years. With no real option in the microsoft camp, we develop mobile apps with FlashBuilder and Flex. We love it.

      We know how to build HTML & JS — We’ve done it for years, but with enterprise applications, the application development environment is also really important. Flashbuilder seems to do a better job than anything I’ve seen.

      I’d love to see a rich Flashbuilder like environment that uses HTML& JS behind the scenes to build iOS & Android apps, but it doesn’t seem like its there yet.

      Maybe Adobe & Apache can use the gap time to push Flex as a good alternative for a while.

    23. Bob Sutton says:

      Well, it would seem that a certain Mark Zuckerberg has the odd reservation about HTML5.

      http://bit.ly/UjtUMM

      Air is just great. Almost there with an client develpment which merges Facebook and Twitter functions with native camera, database and so on to produce an expenses tracking app. Uses EXIF libraries to get image rotation right on iOS, Facebook and Twitter AS3 mobile APIs, geolocation etc. Scrolling lists and interface elements work absolutely peachily on iOS and Android alike.

      Couldn’t have done this without a proper debugger which BTW now works really well for remote device debugging – you can trace into the IDE direct from your app over wireless.

      Yep, Greg, agree with you wholeheartedly – the IDE is a really important part of the production process so maybe we can look forward to breakpoints, trace statements, function step through and so on coming soon to Phonegap soon? Or not.

      Oh, actually there is a debugger. I think. Anyway it all looks absolutely fascinating, and I am sure that this new tool together with the clear, in depth documentation will represent a major step forward when trying to debug your next complex development project. Meanwhile I will stick to trace statements which work.

      https://build.phonegap.com/docs/phonegap-debug

    24. Ihor says:

      I am heppy to see that Flex+Air still a live and news about Flash Builder 4.7 is the best Gift :)
      I was try to move from Flex to HTML5 but each my step was with big problems to solve each task.
      For example – to revrite my Game from AS3 to HTML5: still don’t have a good framework, still need to seach additional external libraris, solve a lot of problems, write from ziro the parts of own code. Also big problems with CrossBrowsers. not all JS Frameworks works good in all browser. Also I found that my code works diff. in Safary for Windows and for Mac.
      As I see: with HTML5 we need to take few frameworks, include adittional a lot of libs, write a lot of custom code.

      For me Flash/AIR/Flex – still the best framework for development. Any my projects was solved and codet in very short time.. It’s FLEX !!! :)

    25. Sion says:

      LOL, I use Unity 4.

    26. Deepak says:

      “PhoneGap for Flex/AIR Mobile Developers”
      Well, with that heading, I assumed we could compile our Flex\AIR code in any platform!! Was really thrilled, but not for a long time until I realised that it’s totally a different story all together ;(

      Anyway, I feel flex is here to stay and not to die. Many people still go with flex\AIR mainly because of the development time it takes (which is really fast, when compared to other options).

      I feel sad that so many people are getting pushed to stone age again, making way for cross browser issues! (HTML, JS)

    27. haris says:

      Is it possible to build a video chat application in phonegap with FMS as media server?

    28. Bruno Emsellem says:

      We have developed quite a large set of applications in Flex, for years. We’re manipulating lots of large images for photo editing, book creations, etc.
      We’ve tried the HTML5 road, it’s just not possible yet. Sure, we can mimic few nice features. But when it come to photobook editing, it comes short compared to Flex.. And to Air. Both in term of performance and support accross devices/OS. HTML5 isn’t yet mature enough to play with many images, in 3D, etc. Dot.
      We migrated our application on iOS and Android, tablett and smartphones. A first rough migration was done in a week by a team of 2. The equivalent developed in native code was estimated in months. We looked at phonegap too.. The cost and delay is just not pragmatic.
      So there are really two points here:
      - beyond some complexity or in certain areas, Flex/Air is still ahead of the game.
      - with a large set of code, migrating is a pain and not effective: cost, learning curve, delay, etc.
      Adobe is pushing Air for games, with Starling. It’s a bit short from my perspective. We are, among others, an example of companies which could leverage this ecosystem if well supported.
      As a conclusion, it’s true that it’s sad to see the community still active and not supported by their evangelists & main provider.

    29. Hernando says:

      Can you comment on :
      - protecting your code with phonegap. I heard that people can easily find your source code
      - app footprint. Is it smaller?, but a typical phonegap app uses also jquey and jquery mobile which represents > 300 kb.

    30. PhoneGap is a very useful platform especially for enterprise apps as you often cannot afford and maintain writing multiple versions of a native app for each platform.
      By using a very modular approach and MVC-style patterns it is possible to create a complex yet maintainable app. See the tutorial on “creating mobile apps with KnockoutJS, PhoneGap, and jQuery Mobile” at: http://blog.monnet-usa.com/?p=420

    31. Hi there! I’m at work surfing around your blog from my new iphone!
      Just wanted to say I love reading through your blog and look forward to all your posts!
      Keep up the outstanding work!

    Leave a Reply