Disable Android 12 default splash screen

Viewed 19112

In the google I/O presentation, google team says that we can disable the default splash screen. I want to do that but I couldn't find the way to do it.

Has anyone able to achieve this?

Later edit:

I misunderstood what speakers told in that video. It seems that you can only edit the default splash screen, not disabling it.

7 Answers

On Android 12, it's not possible to opt out of the splash screen. It' only possible to customize it: icon, window background, exit animation.

By default, the splash screen is shown from user touch until the first frame of your application is drawn, so to minimize the time during which the splash screen is shown, you can try to reduce the launch time of your application.

You can also implement you own exit animation so the transition from the splash screen to the app is more seamless.

If you previously used a dedicated SplashScreenActivity and want to keep that activity, then here is the workaround from official docs.

Unfortunately, you cannot disable the default splash screen directly on Android 12 devices through the APIs they've provided.

If your app has a custom splash screen & you don't want to migrate to this new approach you can try the following hack.

Basically what you've to do is override your splash screen theme in res\values-v31\themes.xml & set a transparent icon.

<!-- My custom theme for splash screen activity -->
<style name="Theme.Splash" parent="Theme.Main">
    <item name="android:windowBackground">@color/background</item>
    <!-- Set a transparent .png as your icon -->
    <item name="android:windowSplashScreenAnimatedIcon">@drawable/transparent_image</item>
</style>

This will get you rid of the default app icon that appears during splash when the app is launch.

The default splash screen is only visible when your app take time to draw its first frame. You can try to reduce the launch time of your application to prevent the slash screen visibility.

Disable the default splash screen is not possible but you can apply the patch to prevent it from the visibility and show your own old customised splash screen.

  1. Customise splash screen to make it transparent:

    <style name="Theme.App.Starting" parent="Theme.SplashScreen">
        <item name="windowSplashScreenBackground">@color/transparent</item>
        <item name="windowSplashScreenAnimatedIcon">@drawable/transparent</item>
        <item name="postSplashScreenTheme">@style/AppTheme</item>
    </style>
    

    Here you need to set your app theme in postSplashScreenTheme

  2. Add splash screen theme to your launcher activity:

    <activity android:theme="@style/Theme.App.Starting">
    
  3. Install splash screen in your launcher activity before the super.onCreate of your onCreate method:

    SplashScreen.installSplashScreen(this);
    

Done!

Note: I am using AppTheme at my application level and add transparent theme in launcher activity only. Also adding AppTheme in splash screen theme with postSplashScreenTheme property.

Disabling the default splash screen that was introduced in Android 12 is not straight-forward. In my opinion, the simplest approach is to modify the app styles.

In your app's values/styles.xml file, make sure you have a "BaseTheme" and an "AppTheme". For example:

<resources>
    <style name="BaseTheme" parent="Theme.AppCompat">
        <!-- [...] -->
    </style>

    <style name="AppTheme" parent="BaseTheme" />
</resources>

Then, in values-v31/styles.xml and more recent versions (e.g., v32), extend "BaseTheme" by adding these items:

<resources>
    <style name="AppTheme" parent="BaseTheme">
        <item name="android:windowSplashScreenAnimatedIcon">@android:color/transparent</item>
        <item name="android:windowSplashScreenAnimationDuration">0</item>
    </style>
</resources>

That way, the default splash screen will be blank, having the background color inherited from "BaseTheme".

you can add this line:

          <item name="android:windowIsTranslucent">true</item>    

in your style.xml file before close style tag. it`s make your default android splash transparent!

There is no direct API to disable the default splash screen but if we add <item name="android:windowIsTranslucent">true</item> to your style

<style name="Theme.RemoveSplashScreenTheme" parent="@style/BaseTheme">
    <item name="android:windowIsTranslucent">true</item>
</style>

And apply this to splash screen Activity.

<activity
        android:name="com.test.SplashScreenActivity"
        android:launchMode="singleInstance"
        android:theme="@style/Theme.RemoveSplashScreenTheme"
        android:noHistory="true" />

this will replace the default splash screen with a transparent screen. This workaround will eliminate the 2 splash screen issue if the app already has one.

Add "android:windowSplashScreenAnimatedIcon" in your Splash theme

<style name="SplashTheme" parent="AppMaterialTheme">
    <item name="android:windowBackground">@drawable/bg_splash</item>
    <item name="android:windowSplashScreenAnimatedIcon">@android:color/transparent</item>

And apply this to your Splash activity

<activity
        android:name=".view.ui.splash.SplashActivity"
        android:enabled="true"
        android:exported="true"
        android:screenOrientation="portrait"
        android:theme="@style/SplashTheme">
Related