I'm trying to implement the new Splash API.
I created a theme
<style name="Theme.CustomSplashScreenTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/primary1BlueDefault</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
Added the theme to manifest
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="${appLabel}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CustomSplashScreenTheme">
And enabled in the activity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()
setContentView(R.layout.activity_main)
if (savedInstanceState == null) {
replaceFragment(MainFragment.newInstance(), R.id.container)
}
}
As result, it works for android 12
But for android less than 12 an incorrect icon is being shown
You need to specify
windowSplashScreenAnimatedIcon
in your theme style for SDK 30 and lower such as:SplashScreen documentation