1
votes

I'm developing an ionic cordova application and i'm using cordova-hot-code-push-plugin. The hot code push plugin is perfeclty fetching the update from the server and installing it. After the installation i'm noticing that other ionic native plugins like Camera,File etc are not working and when I noticed cordova_plugin.js file the plugins are missing in the file.

Here is my 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)
      });
});

}

Here is my cordova-hcp.json

{
   "name": "hot-code-push",
   "ios_identifier": "",
   "android_identifier": "",
   "update": "start",
   "content_url": "https://warehousemobile.000webhostapp.com/warehouse"
}

Before the fetching the update,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"
   };

After fetching the update

  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"
   };
1

1 Answers

0
votes

The problem is with the WKWebView plugin which was recently released by ionic team, it doesn't work well with the Cordova hot code push plugin. Remove the plugin using the command

ionic cordova plugin remove cordova-plugin-ionic-webview --save

And add the below plugin

cordova plugin add cordova-plugin-wkwebview-engine

Hope this helps