cordova-plugin-splashscreen icon indicating copy to clipboard operation
cordova-plugin-splashscreen copied to clipboard

AutoHideSplashScreen "false" not working on first launch on Android

Open drewrygh opened this issue 5 years ago • 9 comments

Bug Report

Problem

Setting AutoHideSplashScreen to false has no effect on the first launch of the app on Android. With subsequent attempts to open the app, the configuration works as expected.

What is expected to happen?

When I open an app for the first time after installation on Android, and AutoHideSplashScreen is set to false, I'd expect that the splash screen is not hidden automatically.

What does actually happen?

When I open an app for the first time after installation on Android, and AutoHideSplashScreen is set to false, the splash screen is hidden automatically (before any calls to manually hide the splash screen are made.)

Information

Command or Code

Environment, Platform, Device

Android — seems to happen on all devices, all Android versions.

Version information

Ionic:

   ionic (Ionic CLI) : 4.2.1
   Ionic Framework   : ionic1 1.3.5
   @ionic/v1-toolkit : 1.0.19

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 40 other plugins)

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.4
   ios-sim           : 6.1.2
   NodeJS            : v11.0.0
   npm               : 6.4.1
   OS                : macOS
   Xcode             : Xcode 10.2.1 Build version 10E1001

Checklist

  • [x] I searched for existing GitHub issues
  • [ ] I updated all Cordova tooling to most recent version Not able to do this at this time.
  • [x] I included all the necessary information above

drewrygh avatar Jun 10 '19 15:06 drewrygh

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

janpio avatar Jun 11 '19 08:06 janpio

@janpio Thanks for the response, I'll try to set one up later today, and will post it here.

drewrygh avatar Jun 11 '19 14:06 drewrygh

Sorry for the delay, I haven't yet been able to reproduce this yet in a plain Cordova app. I haven't played around with Cordova/plugin versions too extensively yet, nor the splash screen configuration, so it's likely related to one of these things — or something Ionic is doing.

If anyone else is having this issue and is able to look into reproducing this in a plain Cordova app, it'd be greatly appreciated. If I have time, I'll continue to try to reproduce this, but I can't guarantee I'll get to it soon.

drewrygh avatar Jun 13 '19 15:06 drewrygh

Did you get this working? I'm having the same issue. I've removed the whole platform and added again multiple times with different settings, and nothing has worked. I've tried putting SplashScreenDelay to 10s, but it still hides as soon as it opens and the app is still loading. AutoHide doesn't work. It seems like something else is overriding it.

One thing that "works" is to show it immediately at deviceready, and then hide it when ready. It looks fine on the devices I have tested, but on others I hope it doesn't "flash" by doing this.

navigator.splashscreen.show();

caleb87 avatar Dec 26 '19 20:12 caleb87

@caleb87 @drewrygh did you both fix this in a more reliable way? navigator.splashscreen.show() is not working consistently for me.

CodeWithOz avatar Jul 31 '20 23:07 CodeWithOz

@caleb87 @drewrygh do you have any hooks that edit your config.xml file? I created a sample app and the splashscreen works properly there (you can see here) so I'm suspecting that either one of my hooks or other installed plugin(s) is overwriting some of the settings in config.xml, since the splashscreen plugin defaults AutoHideSplashScreen to true.

CodeWithOz avatar Aug 05 '20 08:08 CodeWithOz

@janpio hey I'm considering how to deactivate the auto-hide functionality right from the native code because the splashscreen still automatically hides when I set AutoHideSplashScreen to "false" in config.xml. I forked this repo and tried:

boolean autoHide = preferences.getBoolean("AutoHideSplashScreen", true);

to

boolean autoHide = false;

This didn't work (the splashscreen still hides automatically).

  • commenting out this line. This also didn't work.

What else can I try or am I missing something? I have tried creating a simple reproduction (see my comment above) but the plugin works as expected there. Thanks!

CodeWithOz avatar Aug 05 '20 10:08 CodeWithOz

Okay, so it's not just me. I've been working on my first Cordova app and figured I was doing something wrong but the splashscreen keeps auto hiding immediately. I tried implementing the suggested navigator.splashscreen.show() but that didn't seem to work either.

onthez avatar Aug 07 '20 15:08 onthez

The culprit plugin for me was the background-geolocation plugin. I posted about this problem there. @onthez @caleb87 @drewrygh does any of you use that plugin?

CodeWithOz avatar Sep 03 '20 19:09 CodeWithOz