View
 

iPhone: Show loading screen

Page history last edited by Shazron Abdullah 1 mo ago

// NOTE: All PhoneGap functions must be called only after the "deviceReady" event has been sent.

 

// fixed duration loading screen

function showLoadingScreen(durationInSeconds) {

    if (!durationInSeconds) {

        durationInSeconds = prompt("Enter the load duration in seconds", 3);

    }

 

    if (durationInSeconds) {

        options = {

            'duration': durationInSeconds

        };

        navigator.notification.loadingStart(options);

    } else {

        return;

    }

}

 

// standard no duration loading screen, with min duration

var durationOptions = {

    minDuration: 2

};

navigator.notification.loadingStart(durationOptions);

// do other stuff here... when stuff done, stop loading screen

navigator.notification.loadingStop();

 

 

//// UPDATE: In the latest code as of Jun 11th, 2010 there are more options below:

 

function showLoadingScreen(durationInSeconds) 

{

     if (!durationInSeconds) {

          durationInSeconds = prompt("Enter the load duration in seconds", 3);

     }

 

     if (durationInSeconds) {

          options = {

                   'duration': durationInSeconds,

                   'bounceAnimation' : true, // defaults to false

                   'fullScreen' : false, // defaults to true

                   'strokeOpacity' : 0.5, // defaults to 0.65

                   // css3 named color (e.g. 'red') or hex (e.g. FF0000) - no hash prefix! (defaults to white)
                   'strokeColor': "FF0000"

                  'backgroundOpacity' : 0.2, // defaults to 0.9

                 'labelText' : "Downloading…" // defaults to 'Loading…'

          };

          navigator.notification.loadingStart(options);

 

 

Comments (0)

You don't have permission to comment on this page.