I have tried the plugin but I can't seem to figure out how to make it work with Cordova. Without the plugin navigator.splashscreen
isn't defined. What am I missing?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
A plugin should not be needed.
Set the key
AutoHideSplashScreen
toNO
in Cordova.plist, then after device ready fires, usenavigator.splashscreen.hide();
to hide the splash screen.It might be that you are not waiting till
deviceready
before trying to accessnavigator.splashscreen
edit
As mentioned by @respectTheCode below, as of 1.6 this has been removed and codified across platforms as
cordova.exec(null, null, “SplashScreen”, “hide”, [])
OK, I took RespectTheCode's advice and removed the device ready event out of the onLoad function. This is the working code. I'm putting the full code for other's who are learning:
The 1000 is one second. Will not work for less than one second i.e 500. Splash screen just hangs.
This is working for me. If code could be improved, feel free to answer it and I'll bump you up.
Also, PhoneGap/Cordova has a bug where you have to use splash images at the full size of the screen (768x1024). Follow the discussion here: https://issues.apache.org/jira/browse/CB-263
Or here: How to stop iOS launch image moving up in Phonegap / Sencha Touch