Can't replace default splashscreen

@ondralukas1010 and @malmazan: Do you both have the same problem, where the splash screen does not appear on Android 12 (or 13) devices?

Is there any chance you could send me your APK so I can try it on my Android 12 device?

We’re trying to determine whether this is a problem which only affects certain devices.

After uninstalling, rebooting, reinstalling: same as before.

Info from the phone:

bump - we’re still interested in this.

Updated (forgot color also for AndroidWindowSplashScreenBackground).

I now let VoltBuilder create the images to see if that works better. I have the core images requested and in the (minimum) right sizes under resources/. My own images have been removed and config.xml has been updated to reflect that (removed all such references except as per below).

Result:

  • Android 6: small centered round splash screen, yellow background
  • Android 13 (on 11T at least): small centered square splash screen, brown (likely darkened yellow) background

I have this in resources.json:

{
    "fit": "cover",
    "icon-background-source": "#ffcd00",
    "orientation": "portrait",
    "position": "center"
}

The tutorial is not fully clear on what the different fit types result in, but I guess a 2732x2732 image should at least not be scaled down if I use cover.

I guessed icon-background-source (same color as the splash screen’s background) would cover the part of the screen that the splash screen doesn’t cover. It doesn’t. AndroidWindowSplashScreenBackground does though, but with unexpected results (see above).

These are the only icon and splash screen related settings in config.xml:

Globally:

    <preference name="SplashScreenDelay" value="2000" />
    <preference name="AutoHideSplashScreen" value="true" />

For specifically Android:

        <preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/splashTemplate.png" />
        <preference name="AndroidWindowSplashScreenBackground" value="#ffcd00" />

Plase upgrade Generating Icons and Splash Screens | VoltBuilder with this.

For specifically iOS (but I’m not building for iOS right now):

        <preference name="prerendered-icon" value="false"/>

The last job at volt.build is the above.

The small centered icon in the middle of the splash screen seems to be the standard. See Android’s doc on this.

Screen Shot 2023-03-03 at 11.24.30 AM

I guess so. Before it was possible to have it truly cover the screen. On Android 6 it gets even smaller, but in that case the square splash screen shouldn’t be used, right?

If so, what does the fit setting in resources.json do?

Generating the icons and splash screens is handled by the cordova-res documentation.

According to the cordova-res documentation, the fit setting does this: Specify how to fit the image when resizing (default: 'cover').

Here is the output of cordova-res -h:

% cordova-res -h

  Usage: cordova-res [ios|android|windows] [options]

    Generate Cordova resources for native platforms.

    This tool writes to 'config.xml' to register resources with Cordova. Valid
    platform definitions are required. See the Cordova docs[1] for more
    information.

    By default, this tool will look for 'icon.(png|jpg)' and 'splash.(png|jpg)'
    files inside 'resources/'. If an 'icon-foreground.(png|jpg)' file is found
    inside 'resources/android/', Adaptive Icons will be generated for Android.

    To generate platform-specific icons and splash screens, place source images
    in the platform's directory, e.g. 'resources/ios/icon.png'.

    The resources directory is configurable with the '--resources' option. For
    example, to use 'res/' for the resources directory, specify '--resources res'.

    For Android Adaptive Icons, the foreground must be an image, but the
    background may be an image or a color. To use an image, place an
    'icon-background.(png|jpg)' file in 'resources/android/'. To use a color,
    specify a hex color, e.g. '--icon-background-source #FF0000'.

    [1]: https://cordova.apache.org/docs/en/latest/config_ref/index.html#platform

  Options:

    --type <icon|splash|adaptive-icon> ... Only generate one type of resource
    --resources <path> ................... Use a different resources directory (default: 'resources')
    --skip-config ........................ Skip reading/writing to 'config.xml'

    --icon-source <path> ................. Use specified file for icon source image
    --splash-source <path> ............... Use specified file for splash source image
    --icon-foreground-source <path> ...... Use file for foreground of adaptive icon
    --icon-background-source <path|hex> .. Use file or color for background of adaptive icon

    --fit <cover|contain|fill> ........... Specify how to fit the image when resizing (default: 'cover')
    --position <position> ................ Specify how to position the image when resizing (default: 'center')
                                           (positions: 'center', 'top', 'right top', 'right', 'right bottom',
                                                       'bottom', 'left bottom', 'left', 'left top')

    --copy ............................... Copy generated resources to native projects
    --ios-project <path> ................. Use specified directory for iOS native project (default: 'ios')
    --android-project <path> ............. Use specified directory for Android native project (default: 'android')

    -h, --help ........................... Print help for the platform, then quit
    -v, --version ........................ Print version, then quit
    --verbose ............................ Print verbose output to stderr

That hardly made it clearer as no such option makes sense anymore, but I’ll investigate. Thanks for info.

Oddly, on Android 6 the splash screen/icon becomes round, and the size doesn’t adapt to the screen size (it’s kept to 240 units), which means on a very large screen device the splash screen becomes tiny.

It helps to set the background color to other than black (white would be a better default). I’ve set it to the same color as the background of the icon, both in resources.json and AndroidWindowSplashScreenBackground, but as I hinted earlier the background color gets darkened automatically on later Android versions.