capacitor-assets icon indicating copy to clipboard operation
capacitor-assets copied to clipboard

Splash screen is showing app icon instead of splash on Android 12+

Open marekdon opened this issue 2 years ago • 12 comments

When running application on android < 11 devices, splash screen is showing correctly. On devices using android > 12 (new splash screen API), splash screen is replaced by icon.

marekdon avatar Feb 17 '23 15:02 marekdon

I am seeing the same thing

christophermiles avatar Feb 21 '23 03:02 christophermiles

Maybe something to make it look nice for the time being.

If you create a styles-v31 (android 12+) file with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
    <item name="android:windowSplashScreenBackground">#3DDC84</item>
  </style>

</resources>

This will make the background of the splashscreen a specific color, if you match this with you app icon it looks quite alright for most (single color) app icons.

rickbeumers avatar Feb 26 '23 21:02 rickbeumers

Same issue here

eeschiavo avatar Mar 01 '23 10:03 eeschiavo

So we can't use a splash screen graphic any more? It's just the icon with a colored background? That's very disappointing. Does anyone know if this is being worked on?

mvaljento avatar Mar 07 '23 16:03 mvaljento

So we can't use a splash screen graphic any more? It's just the icon with a colored background? That's very disappointing. Does anyone know if this is being worked on?

Android is moving more towards apps without splashscreens.

If you read their documentation on the new API they mention some of this stuff and also some design guidelines. https://developer.android.com/develop/ui/views/launch/splash-screen

For a capacitor application not showing a splash is just impossible since there is actual load time required. I don't like this approach either but for now there doesn't seem to be a workaround other then compiling for a lower SDK version. Anything above compileSdkVersion 30 will use the new splashscreen api. Setting this variable to 30 or lower should give you the old results but you might miss other benefits.

rickbeumers avatar Mar 07 '23 17:03 rickbeumers

Thanks very much for the explanation, @rickbeumers!

mvaljento avatar Mar 10 '23 14:03 mvaljento

Guys, you can still use nine patches splash screens above api level 12.

co-dax avatar Mar 13 '23 13:03 co-dax

Classic Google, pulling the rug on an API instead of letting it gracefully fall back.

I don't understand, can't this library just generate an XML drawable alongside the existing icons it makes?

From this link (https://github.com/apache/cordova-android/pull/1441#issue-1270501465)

The default splash screen is an XML Android Drawable. It has a resolution of 512x512. It is padded and the inner icon size is 384x384. It is also scalled by 50% and pivotX/Y of 256.

jpike88 avatar Mar 15 '23 16:03 jpike88

Hi.

I don't get it.

Does it mean that this repo is not up to date ? I started a fresh capacitor project and by using this, I get this issue.

Should I generate each assets separetly instead of relying on this ?

Thanks for the help.

sboudouk avatar Mar 28 '23 16:03 sboudouk

tl;dr: It's not a bug. It's a feature. Google's new API does not allow full-screen splash screens anymore since Android 12+. You need to use an icon.

https://capacitorjs.com/docs/guides/splash-screens-and-icons

In Android 12 and above Google changed the way Splash Screens are displayed, using a smaller icon with colored background instead of a full screen image that was possible with Android 11 and below. Additional documentation about this change can be found at developer.android.com.

Googles Design Guide https://developer.android.com/develop/ui/views/launch/splash-screen

andrmoel avatar May 31 '23 05:05 andrmoel

Setting the splash screen background color for Android 12+

The comment https://github.com/ionic-team/capacitor-assets/issues/495#issuecomment-1445474546

Maybe something to make it look nice for the time being.

If you create a styles-v31 (android 12+) file with the following contents:

[...]

This will make the background of the splashscreen a specific color, if you match this with you app icon it looks quite alright for most (single color) app icons.

does the trick. Here's a full step by step guide to set the splash screen color for Android 12+:

In the res folder create a new resource directory values-v31

image

As the directory will not be immediately visible (as least that the case for me with the default settings for Android Studio), right click on the res/values directly and select New File from the context menu.

image

Click ok and type styles.xml for the file name.

Paste this:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
        <item name="android:windowSplashScreenBackground">#FF0000</item>
    </style>

</resources>

which should look like this:

image

and save the new file. Restart the app and you should now see a red background color. Adapt color to your needs.

larsblumberg avatar May 14 '24 16:05 larsblumberg

I'm having a weird issue with my Splash Screen being opaque (like with some alpha while the App load) and I tried SplashScreen.show() after the App is initialized and the image is shown with the original vibrant colors. Anyone had this issue before? I'm going crazy :(

matheo avatar Aug 07 '24 00:08 matheo