/cordova-app-update-plugin

In app update support for cordova

Primary LanguageJavaMIT LicenseMIT

cordova-in-app-update

This pluging enabels In app update For cordova.

Supports

  • Flexible update
  • Immeidiate update
  • Stalneess days For both type of updates
  • Priority updates

Configs

  • type : Provides option to user which strategy to use IMMEDIATE or FLEXIBLE or MIXED (Required)
  • stallDays : Provides stalness day configuration for type IMMEDIATE and FLEXIBLE (Required for type IMMEDIATE and FLEXIBLE)
  • flexibleUpdateStalenessDays : Provide stalness days for flexible update in case of type MIXED (Required for type MIXED)
  • immediateUpdateStalenessDays : Provide stalness days for immeidiate update in case of type MIXED (Required for type MIXED)
  • alertTitle (only applicable in ios config) : Provides custom title for IOS alert box (default : "New Version")
  • alertMessage (only applicable in ios config) : Provides custom message for IOS alert box (defualt: "version <version> of <appName> is available on the AppStore.")
  • alertCancelButtonTitle (only applicable in ios config) : Provides custom cancel button title for IOS alert box (default: "Not Now")
  • alertUpdateButtonTitle (only applicable in ios config) : Provides custom update button title for IOS alert box (default: "Update")

Examples

Flexible update with 5 staleness days in both android and ios

window.plugins.updatePlugin.update(()=>{
//success callback
},()=>{
//error callback
},{
   IOS: {
       type: "FLEXIBLE",
       stallDays: 5
   },
   ANDROID: {
        type: "FLEXIBLE",
        stallDays: 5
    }
});

Immediate update with 5 staleness days in both android and ios

window.plugins.updatePlugin.update(()=>{
//success callback
},()=>{
//error callback
},{
   IOS: {
       type: "IMMEDIATE",
       stallDays: 5
   },
   ANDROID: {
        type: "IMMEDIATE",
        stallDays: 5
    }
});

Flexible update with 2 staleness days and Immediate update with 5 stalness days in both android and ios

window.plugins.updatePlugin.update(()=>{
//success callback
},()=>{
//error callback
},{
   IOS: {
        type: "MIXED",
        flexibleUpdateStalenessDays: 2,
        immediateUpdateStalenessDays: 5
   },
   ANDROID: {
        type: "MIXED",
        flexibleUpdateStalenessDays: 2,
        immediateUpdateStalenessDays: 5
    }
});

Flexible update with 2 staleness days and Immediate update with 5 stalness days in both android and ios and custom messages for ios

window.plugins.updatePlugin.update(()=>{
//success callback
},()=>{
//error callback
},{
   IOS: {
        type: "MIXED",
        flexibleUpdateStalenessDays: 2,
        immediateUpdateStalenessDays: 5,
        alertTitle: "Hola new update!",
        alertMessage: "Please update your app for new Features!",
        alertCancelButtonTitle: "Nope",
        alertUpdateButtonTitle: "Go ahead!"
   },
   ANDROID: {
        type: "MIXED",
        flexibleUpdateStalenessDays: 2,
        immediateUpdateStalenessDays: 5
    }
});

Priority (only applicable for android)

stalness will be ignored in this case

  • If priority of released app is >= 3 it will trigger Immediate update
  • If priority of released app is >= 1 it will trigger Flexible update

Note: To determine priority, Google Play uses an integer value between 0 and 5, with 0 being the default, and 5 being the highest priority. To set the priority for an update, use inAppUpdatePriority field under Edits.tracks.releases in the Google Play Developer API. Priority can only be set when rolling out a new release, and cannot be changed later.