Software Archive
Read-only legacy content
17060 Discussions

change splash-screen-duration in intel xdk

Bigfanx__
Beginner
803 Views

Hi,

I want to change the splash screen duration value in my app because I feel the loading time of splash screen in my app is little bit longer before the app index page is loaded. I tried to add the the value "<preference name="splash-screen-duration" value="100000" />"  to make the splash screen disappear earlier in the file "intelxdk.config.additions.xml'', but it didn't work. I know it is not allowed to change the directives in the auto-generated file " intelxdk.config.android.xml". According to the link (https://software.intel.com/en-us/xdk/docs/using-the-cordova-for-android-ios-etc-build-option), it seems I only can modify the directives listed in the auto-generated config. xml file So, is it possible to change the duration value of splash screen in intel xdk? Thanks a lot in advance.

0 Kudos
12 Replies
PaulF_IntelCorp
Employee
803 Views

Which system are you building for? Android or iOS? I believe that preference only works with Android. Do you have the splash screen plugin added to your project?

0 Kudos
Bigfanx__
Beginner
803 Views

Hi Paul,

I am building an app for android. I added the splash plugin in my app. I also added this line "<preference name="splash-screen-duration" value="100000" />"  in the file "intelxdk.config.additions.xml', but it didn't work on my android 4.4 phone unfortunately. BTW, I use the method "navigator.splashscreen.hide()" rather than "intel.xdk.device.hideSplashScreen()"to hide the splash screen in my js. Any ideas? Thanks a lot.

0 Kudos
PaulF_IntelCorp
Employee
803 Views

When you call the navigator.splashscreen.hide() function it short circuits the preference in the config.xml file. So if you want the preference to have priority you should remove the reference to the hide() function. Are you using the code from the template in init-app.js or did you roll your own? Either way, the call which happens after the cordova ready event will undo the preference settings (assuming it happens before the preference timeout).

0 Kudos
Bigfanx__
Beginner
803 Views

Hi Paul,

I call the splash screen hide function in a fairly simple js function as below. I didn't use the default one (xdk.device.hideSplashScreen()) in cordova-init.js. Now, I removed  the function in my app and added the line "<preference name="splash-screen-duration" value="100000" />"  in the file "intelxdk.config.additions.xml. However, the duration of splash screen is even longer than the previous one. It seems that setting the duration value of splash screen won't work anyway.

function onDeviceReady() {
	navigator.splashscreen.hide();
}

 

0 Kudos
John_H_Intel2
Employee
803 Views

Have you tried adding a setTimeout to the splashscreen.hide call? It will delay the call for specified number of ms. 

http://www.w3schools.com/jsref/met_win_settimeout.asp

0 Kudos
PaulF_IntelCorp
Employee
803 Views

@John, excellent suggestion :)

0 Kudos
Bigfanx__
Beginner
803 Views

Hi John,

I tried it without luck. It seems it will further delay hiding the splash screen. Although the function "navigator.splashscreen.hide()" is not very ideal, it is still faster than the default one.

function onDeviceReady() {
	setTimeout(function() { navigator.splashscreen.hide(); }, 30);
}

and

function onDeviceReady() {
	setTimeout( navigator.splashscreen.hide(), 30);
}

 

0 Kudos
John_H_Intel2
Employee
803 Views

Ok, lets rewind here.

Can you explain exactly what your issue is? Does the splashscreen go away to soon? Last to long? Does it go away and the page is not finished loading yet, so it goes away and you the app looks like its still loading? Are you loading remote content to display your main page? 

Sorry for all the questions, just trying to get the root of what you are doing/what you want to do/what you are getting.

0 Kudos
Bigfanx__
Beginner
803 Views

Hi John,

The issue is the splash screen last too long. It is still there after my index page is loaded. I want it to disappear before my index page is loaded. I tried the methods mentioned above but it didn't work. Thanks a lot for help.

0 Kudos
John_H_Intel2
Employee
803 Views

I have attached a zip file of a pretty simple app that hides the splash screen in less than .5 second. Take a look at it and build it.

 

0 Kudos
Bigfanx__
Beginner
803 Views

I'll definitely try it and thanks a lot for your patience and help.
 

0 Kudos
John_H_Intel2
Employee
803 Views

No problem. I was installing on an iPhone 6. Let me know how you make out. 

0 Kudos
Reply