I am building an app using Cordova. Every other thing works but the Splash Screen. Has anyone used it lately? Here is my code: config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>Sample Apache Cordova App</description>
<author email="dev@cordova.apache.org" href="https://cordova.apache.org">
Apache Cordova Team
</author>
<content src="index.html" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<platform name="android">
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<icon density="ldpi" src="res/icon/android/icon-36-ldpi.png" />
<!-- Use the AndroidWindowSplashScreen preferences for splash screen configurations -->
<preference name="AndroidWindowSplashScreen" value="screen" />
<preference name="AndroidWindowSplashScreenAnimationDuration" value="2000" />
<preference name="AndroidWindowSplashScreenContent" value="res/screen/android/land-ldpi.png" />
<!-- Add more splash screen configurations for other densities -->
</platform>
</widget>
Here is my file structure projectRoot platforms plugins www res screen android land-ldpi.png ios
its not working. It keeps showing the default cordova icon as shown in the image below
Any idea what i can try, i have followed almsot all resource i can find online. Any guide that can help in 2023 i would appreciate
Make sure that the path to your splash screen image is correct. The path should be relative to the project root directory. In your case, the splash screen image should be located at res/screen/android/land-ldpi.png
.
If the path is correct and the splash screen image is still not showing up, it's possible that the cordova-plugin-splashscreen
is deprecated in cordova-android@11
and you should use the new splash screen API. You can set the splash screen image and background color using the AndroidWindowSplashScreenAnimatedIcon
and AndroidWindowSplashScreenBackground
preferences respectively:
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/android/splash/xxxhdpi.png" />
<preference name="AndroidWindowSplashScreenBackground" value="#6dADDF" />
In the above code, res/android/splash/xxxhdpi.png
is the path to the image file and #6dADDF
sets the background color of the overall splash screen.
*If you're still facing issues, you might want to remove any tags that refer to the deprecated cordova-plugin-splashscreen
. These tags might be causing conflicts with the new splash screen API.