SplashScreen hide not working as expected

Hello everyone,

I have a small problem with the SplashScreen.

I’m using the new AppWizard and a standard APP with Capacitor and Menu Template (no customization).

In app.component.ts the SplashScreen seems to be switched off as soon as the platform is ready:

 this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });

On a OnePlus 3T, the SplashScreen takes approximately 3 seconds to disappear (seems to be the default time the SplashScreen is shown). If I delete the line of code this.splashScreen.hide(); the time does not change as expected.

If I use the launchShowDuration setting and set it to 10 seconds in the capacitor.config.json file, the splash screen disappears after about 10 seconds.

{
  "appId": "io.ionic.starter"
  "appName": "splash-test",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "www",
  "cordova": {}
  "plugins": {
    "SplashScreen." {
      "launchShowDuration": 10,000
    }
  }
}

If I set ‘LaunchShowDuration’ to 0, the splash screen appears very briefly, then a white image and the application only needs about 1.5 seconds to start. I would have expected that the time would match the test where the SplashScreen is closed programmatically as soon as the application is ready, but the application now starts twice as fast.

If I set the setting ‘launchAutoHide’: false, and comment on ‘this.splashScreen.hide()’ again, the SplashScreen never disappears. It seems that this.splashScreen.hide(); has no effect on the splashScreen at all.

Am I doing something wrong? As already mentioned, it is a standard APP without customization. :slight_smile:

Off-Topic:
One small thing I noticed: cordova-res --skip-config --copy creates a directory ios\App\public without adding an IOS project before.

Thank you very much and best regards
Mario

1 Like

some Ionic templates still have Cordova code instead of Capacitor code, that code is for Cordova, not for Capacitor.
Replace it with Capacitor code https://capacitor.ionicframework.com/docs/apis/splash-screen

1 Like

Thank you, that seems to work. But I have not yet fully understood if ionic-native does not work in capacitor apps and if capacitor plugins are generally preferable?

https://ionicframework.com/docs/native says that it works for cordoca and capacitor.

There is an installation guide under the tab Capacitor, but further down under the Capacitor heading it says “not compatible”: https://ionicframework.com/docs/native/splash-screen

Or is Ionic native generally compatible unless otherwise stated in the https://ionicframework.com/docs/native/ documentation and we can use it if there is no equivalent capacitor plugin available?

Ionic native is generally compatible unless otherwise stated in the documentation

It s not stated in the @native splash screen that it not compatible with capacitor, yet it s not working.

What is the diffrence between using a package from @ionic-native/…/ngx and from { Plugins } from ‘@capacitor/core’; ?

1 Like

The docs say this:

Capacitor

Not compatible

Ionic-native plugins are cordova plugins, capacitor/core are capacitor plugins, if a capacitor plugins is available is always recommended to use it over the cordova alternative.

1 Like

I would like to know too.