navigator.splashscreen.hide() issue in cordova-android v11.0.0 when AutoHideSplashScreen is true or app uses redirect
See original GitHub issueBug Report
Problem
I recently updated Cordova and the Android platform plugin both to v11.0.0, adjusted my config.xml to use AndroidWindowSplashScreenAnimatedIcon
, removed old splash screen entries (except the ones mentioned below) and made a clean build of my project (Node.js 14).
My app was previously able to close the splash screen manually so I had AutoHideSplashScreen
set to true
, SplashScreenDelay
set to 10000
and simply used navigator.splashscreen.hide()
to close the splash screen when my app is ready (depending on the device and connection quality 1-4s). In the worst case it would close after 10s.
[Update]
Further investigation shows that it either happens when AutoHideSplashScreen
is true or when the inAppBrowser
plugin is used for redirection before navigator.splashscreen.hide()
is called.
What is expected to happen?
navigator.splashscreen.hide()
is supposed to close the splash screen before SplashScreenDelay
expires.
What does actually happen?
The splash screen always stays for the full SplashScreenDelay
time.
Information
- I’ve tried different settings for
AutoHideSplashScreen
andSplashScreenDelay
but nothing worked - I can see log entries of my app trying to call
navigator.splashscreen.hide()
after a while with no effect - I’ve done some remote debugging of the app using Chrome and tried to call the hide function manually with no effect (and no error message). Interestingly the remote screen is blank as long as the splash screen is open, but the dev console clearly shows that my app finished loading (including login of the user).
- The exact same code was working in Cordova 9 with Android platform plugin v8.1.0
Command or Code
Set the SplashScreenDelay
to 60s and call navigator.splashscreen.hide()
after device-ready but while the splash screen is still showing.
Environment, Platform, Device
I’ve tested the Android Emulator with Android 12.1, (real) Samsung mobile with Android 8, (real) Samsung tablet with Android 11. Every device has the same issue.
Version information
Cordova: “Pure” Cordova v11.0.0 with Android platform v11.0.0, no Ionic, no Capacitor Windows 11, Android Studio 2021.2.1 Patch 1
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:23 (7 by maintainers)
@bonjourjoel
I am seeing mixed reports.
Can you upload a minimum reproduction repo so that I can run a test?
When tested before release, the
navigator.splashscreen.hide()
method was working.@ljudbane also said,
And this is refering to the
AutoHideSplashScreen
preference flag.6.0.2
if you still need the plugin for the Windows platform.platforms
,plugins
,node_modules
directory and then run thenpm install
&cordova prepare
commands.Also, please create a new issue ticket. The issue you are reporting is about the method not working at all, even with
AutoHideSplashScreen
set tofalse
. The original author’s report is aboutAutoHideSplashScreen
set totrue
for the purpose of mixing of the features, which is different.I’m having the same regression following an upgrade from
cordova-android@10.1.1
tocordova-android@11.0.0
:navigator.splashscreen.hide()
no longer works when used with<preference name="AutoHideSplashScreen" value="true" />
.Notes:
cordova-plugin-splash-screen
has been successfully removedplatforms
andplugins
folders have been correctly removed and reinstalled)cordova-plugin-inappbrowser@5.0.0
and reinstall had no effects (i’m not using redirection while showing splash screen though)