Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marekdon opened this issue Feb 17, 2023 · 11 comments
Open

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

marekdon opened this issue Feb 17, 2023 · 11 comments

Comments

@marekdon
Copy link

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.

@christophermiles
Copy link

I am seeing the same thing

@rickbeumers
Copy link

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.

@eeschiavo
Copy link

Same issue here

@mvaljento
Copy link

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?

@rickbeumers
Copy link

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.

@mvaljento
Copy link

Thanks very much for the explanation, @rickbeumers!

@co-dax
Copy link

co-dax commented Mar 13, 2023

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

@jpike88
Copy link

jpike88 commented Mar 15, 2023

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 (apache/cordova-android#1441 (comment))

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.

@sboudouk
Copy link

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.

@andrmoel
Copy link

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

@larsblumberg
Copy link

larsblumberg commented May 14, 2024

Setting the splash screen background color for Android 12+

The comment #495 (comment)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants