3 Replies Latest reply on Jul 12, 2011 1:14 AM by _spoboyle

    Adobe AIR update framework

    perpor

      Hi all

       

      I am using the framework with an application Flex  built on AIR, no problem, everything is ok.
      (The application is built using the db Sqlite).

       

      Someone knows if it is possible to add one or more script, updating a precise version, to update the db (to add index, fields, etc...) ?

       

      thanks in advance...

        • 1. Re: Adobe AIR update framework
          _spoboyle Level 4

          I asked the same question a little while back and got no responses, here is the solution I am using

           

          http://forums.adobe.com/thread/840583

          • 2. Re: Adobe AIR update framework
            perpor Level 1

            Thank you.

             

            So, if I can understand,  the framework itself does not include possibility of update of the db, and is necessary to execute scripts on the db after the update, like this:

             

                    public function check4Update():void {
                        //setApplicationVersion(); // Find the current version so we can show it below
                        appUpdater.updateURL = AirFlex.APPLICATION.configuration.syncEngineConfiguration.updateURI;
                        appUpdater.isCheckForUpdateVisible = false; // We won't ask permission to check for an update
                        appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate); // Once initialized, run onUpdate
              
                        appUpdater.addEventListener(ErrorEvent.ERROR, onError); // If something goes wrong, run onError
                        appUpdater.initialize(); // Initialize the update framework
                    }

                    private function onError(event:ErrorEvent):void {
                        Alert.show(event.toString());
                    }

                    private function onUpdate(event:UpdateEvent):void {
                        appUpdater.checkNow(); // Go check for an update now
              
               //
               //  now, if the update is ok :
              
               ...... execution of the scripts to update the Db.....................
              
                    }

             

            is right ?????

            • 3. Re: Adobe AIR update framework
              _spoboyle Level 4

              yes that's correct. I always just check against the current db version (which i manualy store and update) however you could place this db update code in an if statement

               

              if (appUpdater.isFirstRun)
              {
                   ...
              }