Search code examples
cordovaionic-frameworkcrashcordova-plugins

How to programmatically reload Cordova Plugins after app crash?


There are times when my Ionic V1 w Cordova App crashes and then immediately restarts in iOS. While I'd prefer it never crash, at the moment I'm working on making sure it recovers properly. The problem is that when it restarts the app the Ionic code is initialized and run properly but none of the Cordova plugins are available.

Is it possible to programmatically reload all the Cordova plugins on startup from the Ionic app?


Solution

  • I don't know how the

    crashes and then immediately restarts in iOS

    part happens, but have you tried to use location.reload()?

    For instance, in index.html

    function onDeviceReady() {
      //...
      location.reload();
      return;
    }
    

    It might do the trick, although I'm not 100% sure.