Software Archive
Read-only legacy content
17061 Discussions

XDK 3522 - Fade splash screen

Honda20
Beginner
305 Views

Hi Intel Support

Which xml file should I open and add this lines for Android Cordova

<preference name="SplashScreenDelay" value="4000" />
<preference name="FadeSplashScreen" value="false"/>

The old version XDK I use to add this in the Addition.xml, however version 3522 does not have this file 'Addition.xml'

Please advice.

Thanks

Honda

0 Kudos
6 Replies
Honda20
Beginner
305 Views

Hi Intel Support

I have found the addition.xml, I have placed this section in the xml file. However, the splashscreen still disappear very fast like 1 sec.

I am using splashscreen v3.2.2 and CLI 6.2.0

<platform name="android">
    <!-- below requires the splash screen plugin -->
    <!-- docs: https://github.com/apache/cordova-plugin-splashscreen -->
    <preference name="ShowSplashScreen" value="true" /> <!-- defaults to "true" -->
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="SplashMaintainAspectRatio" value="false" />
    <preference name="SplashScreenDelay" value="4000" />
    <preference name="FadeSplashScreen" value="false"/>
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="FadeSplashScreenDuration" value="4000"/>
</platform>

Please advice.

Honda20

0 Kudos
Honda20
Beginner
305 Views

I also tried this it didn't work.

  1. In your config.xml file add: <preference name="AutoHideSplashScreen" value="false" />. This will prevent the hiding of the splash screen by itself and it will remain on screen indefinitely;

  2. Listen to the deviceready event;

  3. After the event is fired and at the point you think the app is ready to use just callnavigator.splashscreen.hide();. This will make the splash screen go away and allow the user to use the app;

0 Kudos
Honda20
Beginner
305 Views

When ever I removed the code A or B below in the head tag and replace normal load javascript, the splashscreen delay works but after that it turns white/blank. When ever I placed this code inside the head tag it killed the spashscreen 1 seconds.

Code A  

      function onDeviceReady() {
         iabRef = window.open('http://myurl.com', '_blank', 'location=no');
         iabRef.addEventListener('loadstop', replaceHeaderImage);
         iabRef.addEventListener('exit', iabClose);
    }
    

Code B
       function onDeviceReady() {
         iabRef = window.open('http://myurl.com', '_blank', 'location=no');
    }

0 Kudos
PaulF_IntelCorp
Employee
305 Views

Honda -- please look at the "hello cordova" sample to see when you can hide the splash screen. It can only be done after the deviceready event has occurred.

0 Kudos
Honda20
Beginner
305 Views

Thank you Paul.

I have used the template "Hello Cordova" and the splashscreen show just 1 seconds even I changed the following

<preference name="ShowSplashScreen" value="true" />

 <preference name="SplashScreenDelay" value="6000" />

After the splashscreen, I managed to add a delay 2 seconds before url gets load, the splashscreen show up in 4 seconds then url loads (This problem is solved).

I have another problem here, between the splashscreen and the url load, there is a small gap (1 seconds) showing a white blank screen. How do I remove this please. That is Splashscreen 4 seconds, then white blank page for 1 second then page starts to load. Any idea please?

Is there a way to cache a homepage of my url inside the app? so when app closed and then re-launch, the page will show up right away after the splashscreen.

The Cordova legacy version doesn't have any problem at all, anyway we can get that back on next release?

Please advice.

Thanks

Honda

 

0 Kudos
PaulF_IntelCorp
Employee
305 Views

Honda -- the splash screen is going away in one second because there is a call to hide splashscreen in the app following detection of the deviceready event. That delay setting in the additions file only applies if this call never happens, but if the call happens, it will "short circuit" the delay setting in the config file. Here's the code that is removing the splashscreen in hello cordova > https://github.com/gomobile/sample-hello-cordova/blob/master/www/js/init-app.js#L194 <

I suspect you are seeing a white screen because the splashscreen has been removed but your index.html doesn't including anything meaningful AND you are trying to fill that space with a web site page (your URL), which has an indeterminate time to fill. That white screen is the background of your index.html file before you fill the screen with the contents of your web page.

There will be no returning to the Cordova legacy whitelist mechanism, which should have nothing to do with what you are seeing.

0 Kudos
Reply