I have recently changed my Target SDK Version to 31 (Android 12) and after upgrading I started getting this warning:
The application should not provide its own launch screen.
This is the screenshot:
Is there any better approach to create Splash Screens?
NOTE:
I know it is just a warning and can be ignored but I’m asking for now recommended way to create Splash Screens.
4
Answers
There is better approach now. For Android 12, there is brand new Splash Screen Api which works on previous versions aswell, see more here
It supports theming, custom animations and is super simple to use.
Just change the name, without using "splash" in it.
Starting in Android 12, the SplashScreen API enables a new app launch animation for all apps when running on a device with Android 12 or higher. This includes an into-app motion at launch, a splash screen showing your app icon, and a transition to your app itself.
TLDR; Android provides a new API for integrating SplashScreen.
First, remove the SplashScreen then follow below code block.
Add in build gradle
implementation 'androidx.core:core-splashscreen:1.0.0-rc01'
follow the below steps.
Define:
Then in Manifest check and verify that you given
Theme.App.Starting
Finally, Don’t forget to add.
You also can suppress it using this
@SuppressLint("CustomSplashScreen")
: