Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Owner and Founder. Opencart
SplashScreen basically, the SplashScreen is the first screen that appears when the user opens up any application.
So, it is mandatory that SplashScreen must be innovative as well as eye-catching. No one will like to see a black/white screen at first.
In Flutter, we have two options to add on SplashScreen in the app
We have learned about the methods to create SplashScreen in Flutter but writing the code within just the ic_launcher_background.xml file was supported till Android11.
If you will try to run the same app in Android12, it will display a black screen with a logo in the center.
So, Now comes the issue, that How can we have a Splash Screen which supports the Android12?
Let’s start the implementation-
Step – 1 -> Firstly, we will need to create an Android Resource Directory in the android -> app folder, where the resource type will be “values“.
While creating the directory, we will need to add the version from “Available Qualifiers” and set it as 31.
After creating the directory, we will find it on the path android/app/main/res/values-v31
Step – 2 -> Create a new file named “styles.xml” and add the following code-
Here, we have added the windowSplashScreenBackground, windowSplashScreenAnimatedIcon and postSplashScreenTheme.
windowSplashScreenBackground – It specifies the background color for the SplashScreen.
windowSplashScreenAnimatedIcon – It specifies the path of the icon for the SplashScreen.
postSplashScreenTheme – It specifies the Theme that will be launched after the SplashScreen has completed the loading.
Step – 3 -> After that we will have to add a dependency on android/app/build.gradle level
Step – 4 -> We will have to write a few lines of code in Main.Activity file either in JAVA or in Kotlin.
Step – 5 -> Now, we will have to add the Theme we have created into the AndroidManifest.xml file.
After writing this code, if we try to run your app on the device, it will still not show the Splash Image
The reason is that it will still not able to detect the correct theme for the Android12, so we will need to add the theme details in the styles.xml file in the values folder as well.
In this blog, we have discussed how can we add Splash Screen in Flutter Apps running on devices having Android 12.
I hope it will help you out in understanding.
Thanks for reading!!
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.
Owner, Shop ATV Escape
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.