【发布时间】:2019-01-26 05:07:26
【问题描述】:
我正在开发一个 ionic cordova 应用程序,并且我正在使用 cordova-hot-code-push-plugin。热代码推送插件完美地从服务器获取更新并安装它。安装后,我注意到其他离子原生插件(如 Camera、File 等)无法正常工作,当我注意到 cordova_plugin.js 文件时,文件中缺少插件。
这是我的 app.component.ts
private hotCordovaPushOptions:HotCodePushRequestOptions = {
"config- file":"https://warehousemobile.000webhostapp.com/warehouse/chcp.json",
};
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,private hotCodePush:HotCodePush) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.hotCodePush.fetchUpdate(this.hotCordovaPushOptions).
then(
(value:any)=>{
this.hotCodePush.isUpdateAvailableForInstallation().
then((value:HotCodePushUpdate)=>{
this.hotCodePush.installUpdate().then((res:any)=>{
console.log(res);
}
)
})
},(error:any)=>
{
console.log("e =>"+error)
});
});
}
这是我的cordova-hcp.json
{
"name": "hot-code-push",
"ios_identifier": "",
"android_identifier": "",
"update": "start",
"content_url": "https://warehousemobile.000webhostapp.com/warehouse"
}
在获取更新之前,cordova_plugin.js
module.exports.metadata =
// TOP OF METADATA
{
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-whitelist": "1.3.3",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-ionic-webview": "2.0.3",
"cordova-plugin-ionic-keyboard": "2.1.2",
"cordova-hot-code-push-plugin": "1.5.3"
};
获取更新后
module.exports.metadata =
// TOP OF METADATA
{
"cordova-plugin-device": "2.0.2",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-ionic-webview": "2.0.3",
"cordova-plugin-ionic-keyboard": "2.1.2",
"cordova-hot-code-push-plugin": "1.5.3"
};
【问题讨论】:
标签: cordova ionic-framework cordova-plugins ionic-native