cordova-plugin-nativeapp-updater
v1.0.1
Published
need to update native app
Downloads
4
Maintainers
Readme
cordova-plugin-nativeapp-updater
This pluging use to update native Android In app update and iOS For cordova.
Install latest version from NPM
cordova plugin add cordova-plugin-nativeapp-updater
Install latest version from master
cordova plugin add https://github.com/sylvinrodz/cordova-plugin-nativeapp-updater
Supports
- Flexible update - User can cancel this update
- Immeidiate update - Force update no option to cancel
Configs for iOS
- type : Provides option to user which strategy to use IMMEDIATE or FLEXIBLE (Required)
- stallDays : Provides stalness day configuration for type IMMEDIATE and FLEXIBLE (Required for type IMMEDIATE and FLEXIBLE)
Examples
Flexible update with 5 staleness days for ios
cordova.plugins.NativeAppUpdater.update(()=>{
//success callback
},()=>{
//error callback
},{
IOS: {
type: "FLEXIBLE",
stallDays: 5
}
});
Immediate update with 5 staleness days for ios
cordova.plugins.NativeAppUpdater.update(()=>{
//success callback
},()=>{
//error callback
},{
IOS: {
type: "IMMEDIATE",
stallDays: 5
}
});
Configs for Android
To check for avilable update
var successCallback = function (res) {
console.log(res);
};
var errorCallback = function (err) {console.log(err);};
cordova.plugins.NativeAppUpdater.getUpdateAndroid(successCallback, errorCallback);
Return values
- UPDATE_AVAILABLE
- UPDATE_NOT_AVAILABLE
- DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS
- UNKNOWN
After returning the UPDATE_AVAILABLE , you can use following method is successCallback to show update popup
To Immediate update
cordova.plugins.NativeAppUpdater.Immediate();
To Flexible update
cordova.plugins.NativeAppUpdater.Flexible();