1

I have an issue regarding Phonegap on iOS: splash screen cannot be closed programmatically - it just stays visible.

When I change the splashscreen config to enable autohide, it hides without a problem.

Also note that on Android it works fine.

here is my config:

<preference name="detect-data-types" value="true"/>
<preference name="exit-on-suspend" value="false"/>
<preference name="show-splash-screen-spinner" value="true"/>
<preference name="android-minSdkVersion" value="14"/>
<preference name="android-installLocation" value="auto"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="SplashScreen" value="screen"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="auto-hide-splash-screen" value="false" />
<preference name="SplashScreenDelay" value="100000" />
<preference name="StatusBarOverlaysWebView" value="false" />

 <feature name="SplashScreen">
    <param name="ios-package" value="CDVSplashScreen"/>
    <param name="onload" value="true" />
 </feature>

Javascript (I am using Angular + Ionic framework)

.$ionicPlatform.ready(function () {

   setTimeout(function(){
      navigator.splashscreen.hide();
   }, 1000);
 })
Igor
  • 592
  • 2
  • 9
  • 31

3 Answers3

1

I know this is an older question, but in case somebody else needs help. It might be fine on Android because everything (including navigator.splashscreen) loaded before the deviceready was called. What I had to do was remove the ng-app attribute and add an event listener for deviceready on the index page which then starts the angular application when everything is available.

<script type="text/javascript">
  document.addEventListener('deviceready', function onDeviceReady() {
   angular.bootstrap(document, ['myApp']);
  }, false);
 </script>

I found information on this at:

how to deviceready in right way in ionic application

Ionic Framework Forum

Community
  • 1
  • 1
DigitalMystery
  • 575
  • 1
  • 7
  • 21
0

Is there an error coming from that line? You can check it by alerting in case of exception caught if you aren't using remote debugger for your app. Example:

try {
    navigator.splashscreen.hide();
}
catch (e) {
    alert(e); // This might be object, though, so maybe not showing the cause
}

If there is an error coming, it probably means that you haven't correctly installed the SplashScreen plugin for your application. You can check it as described here.

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
0

You can try following

$ionicPlatform.ready(
function(){
    $cordovaSplashscreen.hide();
});

Note : you need to call $cordivaSplashscreen.hide() function. You might want to use NG Cordova Plugins if you are using the IONIC Framework.

Similarly if you want to use time out you can have following code

$ionicPlatform.ready(function() {
     var hidesplashscreen = function() {
                $cordovaSplashscreen.hide();
     };
     $timeout(hidesplashscreen, 2000);
});
Aadil Keshwani
  • 1,385
  • 1
  • 18
  • 29