Im trying to load some content while splashscreen loads as it is written here:
http://learn.ionicframework.com/formulas/splash-screen/
However i can’t use $cordovaSplashscreen.hide().
It doesn’t give any error after injecting $cordovaSpashScreen into app.run function,
whenever i try to use $cordovaSpashscreen.hide() inside, it gives this error:
It says “cordova plugin add org.apache.cordova.splashscreen” on it’s documentation and i have already installed that.
Btw i tried to run your command but i got an error saying : Platform “cordova-plugin-splashscreen” not recognized as a core cordova platform. See cordova platform list.
The difference between cordova platform add .. and ionic platform add .. is the latter automatically adds the ionic plugin file which allows you to run ionic state restore which restores plugins and their config if you need to update your platforms for any reason.
Try ionic plugin add https://github.com/apache/cordova-plugin-splashscreen.git instead, this is suggested on their documentation as an alternative. Here’s the resource I used as it’s part of ngCordova http://ngcordova.com/docs/plugins/splashscreen/
The problem I think is that you have installed the plugin using cordova command and this hasn’t registered the plugin with ionic correctly.
OK, there’s the problem. Splash screen is a cordova plugin so it is ONLY available on the device and not in the browser.
Only develop on your phone
Cordova plugins do not work while developing in your browser, because each plugin accesses a specific API (such as camera, microphone, accelerometer) which is not available in your browser…
I don’t get the previous error now but right now splashscreen doesn’t want to wait for the images to load…
I even tried to $cordovaSplashscreen.hide(); inside in if(isAndroid) control, without any caching, it doesnt seem to work.
Yes its on the device. Browser doesn’t give any error from now on, but on my android device it doesn’t recognise the changes i’ve made with splashscreen as hiding or hiding till the content is cached.
Remove all the logic for hiding the splash screen, if you have setup your plugin and config.xml correctly it shouldn’t remove the splash screen. Otherwise, you’ve still not got the plugin setup correctly.
This function will only run on a device, so you don’t need to make an android check. Try creating a new project with ionic start and see why this one works and yours doesn’t. compare the config.xml.
Also try removing platforms and re-adding them. (iOS and android).