2 Replies Latest reply on Nov 24, 2008 12:56 PM by dmje

    Notification app in ajax/html

    dmje Level 1
      I'm an AIR noob, but have a load of experience with xhtml/ajax/web services etc. I'm hoping, therefore, to be able to do this in ajax and not using Flex. My Flash is crap :-)

      I want to build a simple desktop notifier. I'm having trouble with two main "design pattern" approaches:

      1. what is the best way to periodically check a web service / feed ? Should I set up some kind of javascript loop which every x minutes pings an xmlhttp request to the service, checks for changes and then returns a result? Or is there a better way?

      2. how to I write an AIR app that minimizes to the system tray / dock yet pops up an alert when there is something new to report. Christian Cantrell's notificationlib ( http://code.google.com/p/as3notificationlib/) looked promising but I can't find any documentation and the example doesn't work for me. I'm too much of a noob to be able to debug.

      Pointers would be much appreciated - I've asked Google and she know nothing :-)
        • 1. Re: Notification app in ajax/html
          Dragos GEORGITA Adobe Employee
          Hi dmje,

          1) yes, setTimeout with pinging the server should do the work
          2) You can get the source code for the application Fresh on this page: http://www.adobe.com/devnet/air/ajax/samples.html
          That's a RSS reader written with HTML/JavaScript. This app can be minimized to tray and it displays notifications when new entries are coming in.
          Basically, minimize to tray can be seen as
          - load a system tray /doc tray icon and add menu on it
          - hide the main window of your application (it doesn't mean it gets destroyed, just visible = false)
          - continue to ping the server for changes and when one comes in, create a new window with no chrome, position it n thue bottom right corner of the window and display the message inside it.

          This is the case when you build the notification system yourself. However, as you pointed out, a better idea is to leverage the notification lib that Christian built. And there is one application that uses that and it's also an Ajax based application built by Jonathan Snook > Snitter Twitter client: http://getsnitter.com/

          Best regards,
          Dragos Georgita | Adobe AIR Engineering

          • 2. Re: Notification app in ajax/html
            dmje Level 1
            Hi Dragos

            Thank you very much - that is really useful. No doubt I'll be back in touch when I've had a chance to look at this!