Add multiple sizes of splash screen in ionic cordova when migrating to android 12 and above

Viewed 470

Am trying to migrate ionic cordova app to android 12 (api 32). Cannot use <splash> tags anymore. instead that I should use <preference name="AndroidWindowSplashScreenAnimatedIcon" value="path to xml/png" />.

Previously I generated resources files with cordova-res, So it automatically adding resources files into config.xml like below,

    <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
    <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
    <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
    <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
    <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
    <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />

How do I do this with new way of adding splash screen..?

<preference name="AndroidWindowSplashScreenAnimatedIcon" value="path to xml/png" />
1 Answers

I just found out that android has changed the SplashScreen API.. So here is the new dimensions for new splash screen logo So looks like we have to give up on splash screen image. You can set the app logo with this preference. Keep in mind that the logo will be displayed in a circled container as in dimension page.

<preference name="AndroidWindowSplashScreenAnimatedIcon" value="path to xml/png" />

You can change background color with

<preference name="AndroidWindowSplashScreenBackground" value="#b51b1b" />
Related