SinaDeveloper Member Dec 3, 2022 #1 Hello How can I make my b4a splash screen compatible with Android 12? As you know, there is a mandatory splash in Android 12 that displays the program icon in a small form and after a few seconds the program starts. This has caused my app to have two splashes on Android 12! Here is how to implement it in Android Studio, but I don't know how to use it in B4A: Migrate your splash screen implementation to Android 12 and later | Views | Android Developers Learn how to migrate your app's custom splash screen implementation to the SplashScreen API to ensure it displays correctly and consistently on Android 12 and later, preventing degraded or unintended user experiences. developer.android.com Thankful
Hello How can I make my b4a splash screen compatible with Android 12? As you know, there is a mandatory splash in Android 12 that displays the program icon in a small form and after a few seconds the program starts. This has caused my app to have two splashes on Android 12! Here is how to implement it in Android Studio, but I don't know how to use it in B4A: Migrate your splash screen implementation to Android 12 and later | Views | Android Developers Learn how to migrate your app's custom splash screen implementation to the SplashScreen API to ensure it displays correctly and consistently on Android 12 and later, preventing degraded or unintended user experiences. developer.android.com Thankful
Solution Erel Dec 4, 2022 agraham said: You can't do that from B4A as you need to add code to the Main activity creation event which is not exposed in B4A Click to expand... It is possible. There is an _oncreate hook: https://www.b4x.com/android/forum/threads/inline-java-code.50141/#content Code: Copy #If JAVA import androidx.core.splashscreen.SplashScreen; public void _onCreate() { BA.Log("onCreate"); SplashScreen splashScreen = SplashScreen.installSplashScreen(this); } #End If I've attached a project that implements some of the steps. It looks like the simplest solution is to remove the custom splash activity.
agraham said: You can't do that from B4A as you need to add code to the Main activity creation event which is not exposed in B4A Click to expand... It is possible. There is an _oncreate hook: https://www.b4x.com/android/forum/threads/inline-java-code.50141/#content Code: Copy #If JAVA import androidx.core.splashscreen.SplashScreen; public void _onCreate() { BA.Log("onCreate"); SplashScreen splashScreen = SplashScreen.installSplashScreen(this); } #End If I've attached a project that implements some of the steps. It looks like the simplest solution is to remove the custom splash activity.
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2022 #21 agraham said: What is all the IME stuff doing in your B4XPages example? Click to expand... It comes from this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-splash-screen.120851/#content It is related to the switch from full screen activity (splash - main) to the standard activity (activity2). This causes an unwanted effect where the activity starts with the wrong size. Upvote 0
agraham said: What is all the IME stuff doing in your B4XPages example? Click to expand... It comes from this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-splash-screen.120851/#content It is related to the switch from full screen activity (splash - main) to the standard activity (activity2). This causes an unwanted effect where the activity starts with the wrong size.
agraham Expert Licensed User Longtime User Dec 4, 2022 #22 Changing the colour in the manifest to pure blue worked for me., though it is the colour of the replacement splash screen so I don't understand "but the Android 12 mandatory splash background is still blue" as I understood this splash screen replaces the mandatory splash screen. B4X: Copy CreateResource(values, colors.xml, <resources> <color name="window">#FF0000FF</color> </resources> Nor do I understand this "Another problem is that the splash screen icon is round, how can I make it rectangular and how can I change its size?" Upvote 0
Changing the colour in the manifest to pure blue worked for me., though it is the colour of the replacement splash screen so I don't understand "but the Android 12 mandatory splash background is still blue" as I understood this splash screen replaces the mandatory splash screen. B4X: Copy CreateResource(values, colors.xml, <resources> <color name="window">#FF0000FF</color> </resources> Nor do I understand this "Another problem is that the splash screen icon is round, how can I make it rectangular and how can I change its size?"
agraham Expert Licensed User Longtime User Dec 5, 2022 #24 I don't understand. Just lay out the splash screen in the Designer as you want it. In the example case it is Splash.bal. Upvote 0
I don't understand. Just lay out the splash screen in the Designer as you want it. In the example case it is Splash.bal.
SinaDeveloper Member Dec 5, 2022 #25 agraham said: I don't understand. Just lay out the splash screen in the Designer as you want it. In the example case it is Splash.bal. Click to expand... I don't know why you don't understand, maybe it's because you don't know the nature of splash screen in Android 12. If you have worked with Android 12, you will understand that it has a mandatory splash screen, which by default only displays the application icon in a small form in the middle of the screen. I want to enlarge the icon of that forced Android 12 splash. In this source, Erel has done this, but because the icon is enlarged, only a piece of it is displayed and it is not complete. Upvote 0
agraham said: I don't understand. Just lay out the splash screen in the Designer as you want it. In the example case it is Splash.bal. Click to expand... I don't know why you don't understand, maybe it's because you don't know the nature of splash screen in Android 12. If you have worked with Android 12, you will understand that it has a mandatory splash screen, which by default only displays the application icon in a small form in the middle of the screen. I want to enlarge the icon of that forced Android 12 splash. In this source, Erel has done this, but because the icon is enlarged, only a piece of it is displayed and it is not complete.
agraham Expert Licensed User Longtime User Dec 5, 2022 #26 I perfectly understand the nature of the splash screen in Android 12. It's you that doesn't understand the posted code. SinaDeveloper said: Erel has done this Click to expand... No he hasn't. Look at the codes he and I posted. Both replace the default Android12 splash screen with the Main activity of the app and add an Activity named Activity2 to replace it as the starting Activity of the app when the splash screen times out. .The layout for Main, Splash.bal, contains an Imageview that loads a png of the the B4X logo. You can make this activity have whatever layout you want for your own splash screen. Upvote 0
I perfectly understand the nature of the splash screen in Android 12. It's you that doesn't understand the posted code. SinaDeveloper said: Erel has done this Click to expand... No he hasn't. Look at the codes he and I posted. Both replace the default Android12 splash screen with the Main activity of the app and add an Activity named Activity2 to replace it as the starting Activity of the app when the splash screen times out. .The layout for Main, Splash.bal, contains an Imageview that loads a png of the the B4X logo. You can make this activity have whatever layout you want for your own splash screen.