From f764448ccc17936009b51be47a9833f150d7c199 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 12 Mar 2015 16:33:55 -0400 Subject: [PATCH] Tweak `PluginManager.setPluginEntries()` to create startup plugins when called post `init()` --- .../src/org/apache/cordova/PluginManager.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java index 030436c6..72ce8d0b 100755 --- a/framework/src/org/apache/cordova/PluginManager.java +++ b/framework/src/org/apache/cordova/PluginManager.java @@ -44,6 +44,7 @@ public class PluginManager { private final CordovaInterface ctx; private final CordovaWebView app; + private boolean isInitialized; public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection pluginEntries) { this.ctx = cordova; @@ -56,13 +57,18 @@ public class PluginManager { } public void setPluginEntries(Collection pluginEntries) { - this.onPause(false); - this.onDestroy(); - pluginMap.clear(); - entryMap.clear(); + if (isInitialized) { + this.onPause(false); + this.onDestroy(); + pluginMap.clear(); + entryMap.clear(); + } for (PluginEntry entry : pluginEntries) { addService(entry); } + if (isInitialized) { + startupPlugins(); + } } /** @@ -70,6 +76,7 @@ public class PluginManager { */ public void init() { LOG.d(TAG, "init()"); + isInitialized = true; this.onPause(false); this.onDestroy(); pluginMap.clear();