AppUpdate namespace

Used to provide server-based updates to the application content.



            


The AppUpdate plugin updates the contents of the www folder of deployed Kapsel
applications.  After an application successfully does a logon to an SAP Mobile Platform 3
server, the AppUpdate plugin is able to download an available update. See Uploading Hybrid Apps in user documentation
for information on how to upload an update to SAP Mobile Platform 3 server.


            


After an update is completely downloaded, the application user is 
prompted to install the update and restart the application.  They can decline
if they wish.


            


Once an update is installed, the application's revision number is updated.


            


            Adding and Removing the AppUpdate Plugin
            


The AppUpdate plugin is added and removed using the
Cordova CLI.


            


To add the AppUpdate plugin to your project, use the following command:


cordova plugin add <path to directory containing Kapsel plugins>\appupdate


            


To remove the AppUpdate plugin from your project, use the following command:


cordova plugin rm com.sap.mp.cordova.plugins.appupdate


            



            Hybrid App Revision Preference
            


This is an optional preference that tells the AppUdate plugin if the local 
assets are uploaded to the server, and at what number.  If this preference is 
not provided, the default revision is 0.
In your config.xml file you can add the following preference:


<preference name="hybridapprevision" value="1" />


            


This means that the local assets in your www folder are uploaded to the server 
and the server is reporting revision 1 for them.  This allows the application 
to receive a delta update when revision 2 is available instead of a full update.


            



            Caveats
            


It is important to test that your update has valid HTML, Javascript, and CSS.  
Otherwise, the update could prevent the application from functioning correctly, 
and may no longer be updateable.  You can test the updated application in a 
separate simulator or additional test device.  You can also validate your 
Javascript with tools like JSLint, or 
JSHint.  
You can validate CSS with CSS Lint.


            


         

Methods

Name Description
addEventListener( eventname, f ) Add a listener for an AppUpdate event.
reloadApp() Replaces the app resources with any newly downloaded resources.
removeEventListener( eventname, f ) Removes a listener for an AppUpdate event.
reset() Removes all local updates and loads the original web assets bundled with the app.
update() Force an update check.

Events

Name Description
checking Event fired when AppUpdate is checking for an update.
downloading Event fired when AppUpdate has found an update and is starting the download.
error Event fired when AppUpdate encounters an error while checking for an update or downloading an update.
noupdate Event fired when AppUpdate finds no available updates on server.
progress Event fired when AppUpdate has made progress downloading the update.
updateready Event fired when AppUpdate has a newly downloaded update available.

Source

appupdate.js, line 85.