question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

navigator.splashscreen.hide() issue in cordova-android v11.0.0 when AutoHideSplashScreen is true or app uses redirect

See original GitHub issue

Bug 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 and SplashScreenDelay 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
erisucommented, Aug 16, 2022

@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,

If i set the above preference to false, then it works.

And this is refering to the AutoHideSplashScreen preference flag.

  • Make sure you are not installing the old splash screen plugin as it might conflict. Or install at least version 6.0.2 if you still need the plugin for the Windows platform.
  • Maybe also try a clean project. For example remove the platforms, plugins, node_modules directory and then run the npm 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 to false. The original author’s report is about AutoHideSplashScreen set to true for the purpose of mixing of the features, which is different.

1reaction
mcastetscommented, Nov 23, 2022

I’m having the same regression following an upgrade from cordova-android@10.1.1 to cordova-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 removed
  • a fresh install of the cordova platform has been done (platforms and plugins folders have been correctly removed and reinstalled)
  • I’m also using cordova-plugin-inappbrowser@5.0.0 and reinstall had no effects (i’m not using redirection while showing splash screen though)
Read more comments on GitHub >

github_iconTop Results From Across the Web

navigator.splashscreen.hide() not working on cordova- ...
I use AutoHideSplashScreen = false so that I can hide the splash screen after the UI is rendered. This works fine on iOS...
Read more >
Splash Screen - Apache Cordova
Splash Screen. This core feature gives the ability to configure and control the platform's splash screen while your web application is launching.
Read more >
mp-cordova-plugin-splashscreen - npm package
Splash screen hidden after amount of time specified in the SplashScreenDelay preference. <preference name="AutoHideSplashScreen" value="true" />.
Read more >
navigator.splashscreen.hide() issue in cordova-android ...
navigator.splashscreen.hide() issue in cordova-android v11.0.0 when AutoHideSplashScreen is true or app uses redirect. apache/cordova-android. Issue ...
Read more >
cordova-plugin-splashscreen
When set to true the splash screen will only appear on application launch. However, if you plan to use navigator.app.exitApp() to close the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found