Apache Cordova
  1. Apache Cordova
  2. CB-8345

Splash screen does not display on Android.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android, CordovaLib
    • Labels:
      None
    • Environment:

      OS: Ubuntu 14.04 LTS/x64
      Node.js: 0.10.35
      Cordova: 4.2.0

      Description

      Splash screen does not display on Android. On iOS it is displayed.

      $ cordova --version
      4.2.0
      $ cordova create project1
      $ cd project1
      $ cordova platform add android ios
      $ cordova emulate

      The iOS simulator splash screen is displayed. However, the Android Emulator it is not displayed.

      It seems to be resolved by adding the following sentence to the config.xml, but wanting to be displayed in the default state.

      <preference name="SplashScreen" value="screen" />

      It seems to be solved by modifying the CordovaActivity.java.

      $ diff -Nur CordovaActivity.java.orig CordovaActivity.java
      — CordovaActivity.java.orig 2015-01-22 16:39:42.000000000 +0900
      +++ CordovaActivity.java 2015-01-22 16:39:56.000000000 +0900
      @@ -359,7 +359,7 @@
      init();
      }
      this.splashscreenTime = preferences.getInteger("SplashScreenDelay", this.splashscreenTime);

      • String splash = preferences.getString("SplashScreen", null);
        + String splash = preferences.getString("SplashScreen", "screen");
        if(this.splashscreenTime > 0 && splash != null)
        {
        this.splashscreen = getResources().getIdentifier(splash, "drawable", getClass().getPackage().getName());;

        Activity

        Hide
        Joe Bowser added a comment -

        This doesn't seem right. I believe that this has already been resolved, can you check?

        Show
        Joe Bowser added a comment - This doesn't seem right. I believe that this has already been resolved, can you check?
        Hide
        Andrew Grieve added a comment -

        Yep, the splashscreen is disabled by default. To enable it, add:

        <preference name="SplashScreen" value="splash" />
        

        to your config.xml

        Show
        Andrew Grieve added a comment - Yep, the splashscreen is disabled by default. To enable it, add: <preference name= "SplashScreen" value= "splash" /> to your config.xml
        Hide
        Joe Bowser added a comment -

        I misread this as he tried to specify a splashscreen. Strange.

        Show
        Joe Bowser added a comment - I misread this as he tried to specify a splashscreen. Strange.
        Hide
        Tomo Masakura added a comment -

        If by default disabled, I would like you to disable SplashScreen with iOS Platform. Also, I would like you to add it to cordova documents.

        http://cordova.apache.org/docs/en/edge/config_ref_images.md.html#Icons%20and%20Splash%20Screens

        Show
        Tomo Masakura added a comment - If by default disabled, I would like you to disable SplashScreen with iOS Platform. Also, I would like you to add it to cordova documents. http://cordova.apache.org/docs/en/edge/config_ref_images.md.html#Icons%20and%20Splash%20Screens
        Hide
        Raymond Camden added a comment -

        This just hit me as well. It doesn't make sense to me that the lack of this value should be perceived as not wanting a splash screen. My config.xml file specifically includes a spash element. This particular tag is just for specifying what filename should be looked for, not whether or not the feature is enabled.

        At minimum, then it should be consistent. I don't agree with making this preference required, but iOS should act the same.

        Show
        Raymond Camden added a comment - This just hit me as well. It doesn't make sense to me that the lack of this value should be perceived as not wanting a splash screen. My config.xml file specifically includes a spash element. This particular tag is just for specifying what filename should be looked for, not whether or not the feature is enabled. At minimum, then it should be consistent. I don't agree with making this preference required, but iOS should act the same.
        Hide
        Raymond Camden added a comment -

        I also strongly disagree with this not being a problem. It absolutely is a problem if it doesn't work as documented.

        Heck, it isn't even mentioned here: http://cordova.apache.org/docs/en/4.0.0/config_ref_images.md.html#Icons%20and%20Splash%20Screens

        So if this current behavior is considered right, I'd say that doc needs updating, as well as the one here, http://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_config.md.html#Android%20Configuration, to make it clear that the Splashscreen preference is required for Android.

        Show
        Raymond Camden added a comment - I also strongly disagree with this not being a problem. It absolutely is a problem if it doesn't work as documented. Heck, it isn't even mentioned here: http://cordova.apache.org/docs/en/4.0.0/config_ref_images.md.html#Icons%20and%20Splash%20Screens So if this current behavior is considered right, I'd say that doc needs updating, as well as the one here, http://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_config.md.html#Android%20Configuration , to make it clear that the Splashscreen preference is required for Android.
        Hide
        Andrew Grieve added a comment -

        With Android's splashscreen being broken into a plugin, certainly does make sense now to have it work without a preference.

        Show
        Andrew Grieve added a comment - With Android's splashscreen being broken into a plugin, certainly does make sense now to have it work without a preference.
        Hide
        Raymond Camden added a comment -

        Andrew, can you speak a bit more about your comment? Are you saying that going forward it will require a plugin, even if you don't need to programatically close/show the screen?

        Show
        Raymond Camden added a comment - Andrew, can you speak a bit more about your comment? Are you saying that going forward it will require a plugin, even if you don't need to programatically close/show the screen?
        Hide
        Andrew Grieve added a comment -

        Starting with android-4.0.0, it will require a plugin to show it at all.

        Show
        Andrew Grieve added a comment - Starting with android-4.0.0, it will require a plugin to show it at all.
        Hide
        Raymond Camden added a comment -

        Can I ask why? Currently icons can be configured w/o a plugin. Also, iOS shows a splash screen by default. Will iOS stop showing a splash screen by default? If I don't want to work with the SS via JS, I just want to customize it, isn't it simpler to be able to edit config.xml and have that work out of the box? (Btw, I apologize if this was hashed out on the mailing list!)

        Show
        Raymond Camden added a comment - Can I ask why? Currently icons can be configured w/o a plugin. Also, iOS shows a splash screen by default. Will iOS stop showing a splash screen by default? If I don't want to work with the SS via JS, I just want to customize it, isn't it simpler to be able to edit config.xml and have that work out of the box? (Btw, I apologize if this was hashed out on the mailing list!)
        Hide
        Andrew Grieve added a comment -

        Of course! Two reasons.
        1. It simplifies the code in cordova-android quite a bit
        2. Splash Screens are not a native concept for Android apps like they are on iOS (where they are called "Launch Images"). It's perfectly normal on Android to not have a splash screen, or even to implement your own loading page in html.

        Splash screen logic has actually been split out into the plugin ever since 3.0. Without the plugin installed, all you will see is the launch image. With the plugin, the launch image is replaced by a full-screen UIImage that is the "Splash Screen". And this remains until the onload event.

        Show
        Andrew Grieve added a comment - Of course! Two reasons. 1. It simplifies the code in cordova-android quite a bit 2. Splash Screens are not a native concept for Android apps like they are on iOS (where they are called "Launch Images"). It's perfectly normal on Android to not have a splash screen, or even to implement your own loading page in html. Splash screen logic has actually been split out into the plugin ever since 3.0. Without the plugin installed, all you will see is the launch image. With the plugin, the launch image is replaced by a full-screen UIImage that is the "Splash Screen". And this remains until the onload event.
        Hide
        Raymond Camden added a comment -

        Wow, it never occurred to me to think SS wouldn't be normal on Android. Maybe I jump around platforms too much.

        So I want to make sure I understand where things are heading - forgive me if I rephrase what you've said.

        1) The SS plugin will be required to have a custom SS for any platform.
        2) You will use <splash> tags in config.xml to tell Cordova what image to use.
        3) Will <preference name="SplashScreen" value="splash" /> being required go away since a) I've added the SS plugin and b) it is the default anyway so it should work?

        Show
        Raymond Camden added a comment - Wow, it never occurred to me to think SS wouldn't be normal on Android. Maybe I jump around platforms too much. So I want to make sure I understand where things are heading - forgive me if I rephrase what you've said. 1) The SS plugin will be required to have a custom SS for any platform. 2) You will use <splash> tags in config.xml to tell Cordova what image to use. 3) Will <preference name="SplashScreen" value="splash" /> being required go away since a) I've added the SS plugin and b) it is the default anyway so it should work?
        Hide
        Andrew Grieve added a comment -

        That all sounds right

        Show
        Andrew Grieve added a comment - That all sounds right
        Hide
        ASF subversion and git services added a comment -

        Commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=1d89a2a ]

        CB-8345 android: Make "splash" the default resource ID instead of null

        Show
        ASF subversion and git services added a comment - Commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=1d89a2a ] CB-8345 android: Make "splash" the default resource ID instead of null
        Hide
        Andrew Grieve added a comment -

        Fixed in 1.0.1-dev

        Show
        Andrew Grieve added a comment - Fixed in 1.0.1-dev
        Hide
        Tomo Masakura added a comment - - edited

        Hi Andrew. Thanks!

        I understand that does not appear splash screen without we not install the plugin from cordova-android@4.0.0.

        In addition, I have also understood the special case of iOS.

        However, I think that use "screen" instead of "splash". Because, the file name of the cordova-android's splash image is "screen".

        https://github.com/apache/cordova-android/tree/master/bin/templates/project/res/drawable-land-hdpi

        Show
        Tomo Masakura added a comment - - edited Hi Andrew. Thanks! I understand that does not appear splash screen without we not install the plugin from cordova-android@4.0.0. In addition, I have also understood the special case of iOS. However, I think that use "screen" instead of "splash". Because, the file name of the cordova-android's splash image is "screen". https://github.com/apache/cordova-android/tree/master/bin/templates/project/res/drawable-land-hdpi
        Hide
        ASF subversion and git services added a comment -

        Commit ba6730e5941a4e33f8b38e80b038a741671bcc9f in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=ba6730e ]

        Revert "CB-8345 android: Make "splash" the default resource ID instead of null"

        This reverts commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b.
        There were some other changes in there that weren't meant to be made!

        Show
        ASF subversion and git services added a comment - Commit ba6730e5941a4e33f8b38e80b038a741671bcc9f in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=ba6730e ] Revert " CB-8345 android: Make "splash" the default resource ID instead of null" This reverts commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b. There were some other changes in there that weren't meant to be made!
        Hide
        ASF subversion and git services added a comment -

        Commit 9b3f750085c08de9a4210079af52786851da4f80 in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=9b3f750 ]

        CB-8345 Make default for splashscreen resource "screen" (which is what template and CLI assume it to be)

        Show
        ASF subversion and git services added a comment - Commit 9b3f750085c08de9a4210079af52786851da4f80 in cordova-plugin-splashscreen's branch refs/heads/master from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=9b3f750 ] CB-8345 Make default for splashscreen resource "screen" (which is what template and CLI assume it to be)
        Hide
        Andrew Grieve added a comment -

        Thanks Tomo Masakura! I've fixed it up.

        Show
        Andrew Grieve added a comment - Thanks Tomo Masakura ! I've fixed it up.
        Hide
        Tomo Masakura added a comment - - edited

        Thanks! I confirmed that it work correctly.

        $ cordova create cordova1
        $ cd cordova1
        $ cordova platform add https://github.com/apache/cordova-android.git
        $ cordova emulate

        Splash screen does not appear at this point.

        $ cordova plugin add https://github.com/apache/cordova-plugin-splashscreen.git
        $ cordova emulate

        Now splash screen is appeared.

        Show
        Tomo Masakura added a comment - - edited Thanks! I confirmed that it work correctly. $ cordova create cordova1 $ cd cordova1 $ cordova platform add https://github.com/apache/cordova-android.git $ cordova emulate Splash screen does not appear at this point. $ cordova plugin add https://github.com/apache/cordova-plugin-splashscreen.git $ cordova emulate Now splash screen is appeared.
        Hide
        ASF subversion and git services added a comment -

        Commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=1d89a2a ]

        CB-8345 android: Make "splash" the default resource ID instead of null

        Show
        ASF subversion and git services added a comment - Commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=1d89a2a ] CB-8345 android: Make "splash" the default resource ID instead of null
        Hide
        ASF subversion and git services added a comment -

        Commit ba6730e5941a4e33f8b38e80b038a741671bcc9f in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=ba6730e ]

        Revert "CB-8345 android: Make "splash" the default resource ID instead of null"

        This reverts commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b.
        There were some other changes in there that weren't meant to be made!

        Show
        ASF subversion and git services added a comment - Commit ba6730e5941a4e33f8b38e80b038a741671bcc9f in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=ba6730e ] Revert " CB-8345 android: Make "splash" the default resource ID instead of null" This reverts commit 1d89a2aa1bf0b714d0debf5928cd85e66bbd090b. There were some other changes in there that weren't meant to be made!
        Hide
        ASF subversion and git services added a comment -

        Commit 9b3f750085c08de9a4210079af52786851da4f80 in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=9b3f750 ]

        CB-8345 Make default for splashscreen resource "screen" (which is what template and CLI assume it to be)

        Show
        ASF subversion and git services added a comment - Commit 9b3f750085c08de9a4210079af52786851da4f80 in cordova-plugin-splashscreen's branch refs/heads/old-ID from Andrew Grieve [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-splashscreen.git;h=9b3f750 ] CB-8345 Make default for splashscreen resource "screen" (which is what template and CLI assume it to be)

          People

          • Assignee:
            Andrew Grieve
            Reporter:
            Tomo Masakura
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development