breautek commented on issue #1715: URL: https://github.com/apache/cordova-android/issues/1715#issuecomment-2139464094
I do not believe it's related to #1605 which simply makes `CoreAndroid` (a plugin itself) be loaded via "onload", which is the equivalent of it doing `<param name="onload" value="true" />` if it actually had it's own `plugin.xml`. [CoreAndroid](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CoreAndroid.java) isn't responsible for managing plugins or "starting" any plugins. It's purpose is to provide some core JS apis to handle hardware back button presses, among couple of other niche things. In otherwords, #1605 wouldn't have changed plugin loading behaviour of other plugins which uses `onload`. With that being said, I'm not so certain this is a bug with cordova-android either. The `onload` parameter is to initialise the plugins on platform startup which the PluginManager does so [here](https://github.com/apache/cordova-android/blame/master/framework/src/org/apache/cordova/PluginManager.java#L98), invoked by [CordovaWebViewImpl.init](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaWebViewImpl.java#L119). This initialization chain starts [here](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaActivity.java#L234). The init makes and configures the webview and initialises all plugins that has the `onload` parameter set to `true`. The loading of the webview app happens later, [here](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaActivity.java#L240). Noting that these parts of the codebase hasn't changed for 10+ years, if you use the `blame` tool to see when the last changes on those lines occurred. So for about a decade, `onload` plugins always were initialised before the webview was fully loaded. Attempting to call JS on plugin initialise while the plugin is initialised `onload` will likely result in a race condition, depending on how the plugin invokes a JS call. I acknowledge that the documentation does not detail any of this whatsoever. The android plugin docs has 2 sentences noting the existence of the `onload` parameter, that's about it. Which is why I took the time to dig through the code base to get an understanding on how plugins gets initialised. If anything this highlights an issue with our documentation, but behaviour wise I do not think this is a bug with cordova-android. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org