Latest Beta version of Android SDK showcasing Default Splash Screen on every app running on Android 12 (Emulator), As per the requirements, we already have our own Splash Screen.
If anyone have worked on it, let me know how to disable/remove it (preferred to have and example code).
As per official Document we can customise default splash screen of Android 12 and higher versions, Or you can Migrate your existing splash screen implementation to Android 12 and higher, i have used following steps to customise my apps splash screen
Step 1 : Add below gradle line in build.gradle (App level) and Sync Now
implementation 'androidx.core:core-splashscreen:1.1.0-alpha01'
Setp 2 : Add below lines of code to your themes.xml
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<!-- Set the splash screen background, animated icon, and animation duration. -->
<item name="windowSplashScreenBackground">@android:color/transparent</item>
<item name="windowSplashScreenAnimationDuration">50</item>
<!-- Set the theme of the Activity that directly follows your splash screen. -->
<!-- Required -->
<item name="postSplashScreenTheme">@style/Theme.Your_App_Name</item>
</style>
Step 3 : Now apply "Theme.App.Starting" theme in splash screen from manifest.xml, after apply theme code will be look like below
<activity
android:theme="@style/Theme.App.Starting"
android:name=".Splash"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Step 4 : Now add below line of code to Splash screen activity in onCreate() method before super.onCreate(savedInstanceState);
SplashScreen.installSplashScreen(this);
After add above code in your splash screen activity onCreate() mwthod will be look like this
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.installSplashScreen(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
}
Now default splash screen customised
Note : I have answered of this question in Java, you can convert these lines of codes in kotlin
Happy coding.