breautek commented on issue #1510:
URL:
https://github.com/apache/cordova-android/issues/1510#issuecomment-1281292250
`cordovaInterface.pluginManager.postMessage("setupSplashScreen",
splashScreen);`
This line itself just broadcasts a message to cordova plugins. I think it's
probably safe to assume there are no plugins except for Cordova's (internal)
splashscreen plugin which responds to `"setupSplashScreen"` by actually
configuring the Splashscreen. It however does have to iterate over all plugins
which has to be a synchronized process since Java hashmaps are not threadsafe.
If an app has several plugins I can see how this could be slow. The best way to
test if this is the case is to probably eliminate this step altogether. I think
you're probably in a better position to experiment, but here is what I'd try:
Replace/comment out:
```java
// Setup the splash screen based on preference
settingscordovaInterface.pluginManager.postMessage("setupSplashScreen",
splashScreen);
```
with...
```java
cordovaInterface.pluginManager.getPlugin(SplashScreenPlugin.PLUGIN_NAME).onMessage("setupSplashScreen",
splashscreen);
```
Untested, and not intended to be production code, but it should skip the
synchronized hashmap iteration and go straight to the splashscreen setup code,
at the expense that other plugins won't receive the message (Which imo,
probably not an issue). If you still see slow starts, then it suggests it might
be the Android Splashscreen API itself that is causing the slow start.
It's also not clear what a slow start here means. Is this counting time
before seeing the splashscreen, or does it include time spent showing the
splashscreen? If the latter, using `SplashScreenDelay` to artificially keep the
splashscreen displayed for an extended period of time could trigger slow starts
I presume? I don't know if that is something you are using or not, it's just a
thought.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]