Skip to content

Commit 1ea0bf3

Browse files
authored
1 parent afcdcf9 commit 1ea0bf3

File tree

1 file changed

+35
-55
lines changed

1 file changed

+35
-55
lines changed

src/content/platform-integration/android/splash-screen.md

Lines changed: 35 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,31 @@ description: Learn how to add a splash screen to your Android app.
66

77
<img src='/assets/images/docs/development/ui/splash-screen/android-splash-screen/splash-screens_header.png' alt="A graphic outlining the launch flow of an app including a splash screen">
88

9-
Splash screens (also known as launch screens) provide
9+
## Overview
10+
11+
A splash screens (also known as a launch screen) provides
1012
a simple initial experience while your Android app loads.
11-
They set the stage for your application,
13+
It sets the stage for your application,
1214
while allowing time for the app engine
1315
to load and your app to initialize.
1416

15-
## Overview
17+
You have a couple options for implementing a splash screen:
1618

17-
:::warning
18-
If you are experiencing a crash from implementing a splash screen, you
19-
might need to migrate your code. See detailed instructions in the
20-
[Deprecated Splash Screen API Migration guide][].
21-
:::
19+
1. You can use one of the packages available on [pub.dev][].
2220

23-
In Android, there are two separate screens that you can control:
24-
a _launch screen_ shown while your Android app initializes,
25-
and a _splash screen_ that displays while the Flutter experience
26-
initializes.
21+
2. You can implement it manually, as shown in the
22+
[splash screen sample app][]. The rest of this page
23+
assumes the manual approach.
2724

28-
:::note
29-
As of Flutter 2.5, the launch and splash screens have been
30-
consolidated—Flutter now only implements the Android launch screen,
31-
which is displayed until the framework draws the first frame.
32-
This launch screen can act as both an Android launch screen and an
33-
Android splash screen via customization, and thus, is referred to
34-
as both terms. For example of such customization, check out the
35-
[Android splash screen sample app][].
36-
37-
If, prior to 2.5, you used `flutter create` to create an app,
38-
and you run the app on 2.5 or later, the app might crash.
39-
For more info, see the [Deprecated Splash Screen API Migration guide][].
40-
:::
25+
[pub.dev]: {{site.pub}}/packages?q=splash+screen
26+
[splash screen sample app]: {{site.github}}/flutter/samples/tree/main/android_splash_screen
27+
28+
## Initializing the app
29+
30+
Every Android app requires initialization time while the
31+
operating system sets up the app's process.
32+
Android provides the concept of a [launch screen][] to
33+
display a `Drawable` while the app is initializing.
4134

4235
:::note
4336
For apps that embed one or more Flutter screens within an
@@ -47,17 +40,10 @@ same engine throughout your app to minimize wait
4740
time associated with initialization of the Flutter engine.
4841
:::
4942

50-
## Initializing the app
51-
52-
Every Android app requires initialization time while the
53-
operating system sets up the app's process.
54-
Android provides the concept of a [launch screen][] to
55-
display a `Drawable` while the app is initializing.
56-
5743
A `Drawable` is an Android graphic.
5844
To learn how to add a `Drawable` to your
5945
Flutter project in Android Studio,
60-
check out [Import drawables into your project][drawables]
46+
check out [Import drawables into your project][drawables][]
6147
in the Android developer documentation.
6248

6349
The default Flutter project template includes a definition
@@ -117,17 +103,11 @@ to the normal theme at the appropriate time.
117103
The Android app now displays the desired launch screen
118104
while the app initializes.
119105

120-
## Android 12
121-
122-
To configure your launch screen on Android 12,
123-
check out [Android Splash Screens][].
106+
## SplashScreen API
124107

125-
As of Android 12, you must use the new splash screen
126-
API in your `styles.xml` file.
127-
Consider creating an alternate resource file for Android 12 and higher.
128-
Also make sure that your background image is in line with
129-
the icon guidelines;
130-
check out [Android Splash Screens][] for more details.
108+
Android 12 introduced the [`SplashScreen`][] API.
109+
Use the `SplashScreen` API in your `styles.xml`file.
110+
For example:
131111

132112
```xml
133113
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
@@ -136,13 +116,17 @@ check out [Android Splash Screens][] for more details.
136116
</style>
137117
```
138118

139-
Make sure that
140-
`io.flutter.embedding.android.SplashScreenDrawable` is
141-
**not** set in your manifest, and that `provideSplashScreen`
142-
is **not** implemented, as these APIs are deprecated.
143-
Doing so causes the Android launch screen to fade smoothly
144-
into the Flutter when the
145-
app is launched and the app might crash.
119+
:::note
120+
If your Android app supports releases earlier than Android 12
121+
_and_ post-Android 12 releases, consider using
122+
two different resources in your `styles.xml` file.
123+
Also, make sure that your background image is in line with
124+
the icon guidelines. For more information,
125+
visit [Android Splash Screens][].
126+
:::
127+
128+
[Android Splash Screens]: https://developer.android.com/develop/ui/views/launch/splash-screen
129+
[`SplashScreen`]: https://developer.android.com/reference/android/window/SplashScreen
146130

147131
Some apps might want to continue showing the last frame of
148132
the Android launch screen in Flutter. For example,
@@ -214,11 +198,7 @@ Then, you can reimplement the first frame in Flutter
214198
that shows elements of your Android launch screen in
215199
the same positions on screen.
216200
For an example of this, check out the
217-
[Android splash screen sample app][].
201+
[splash screen sample app][].
218202

219-
[Android Splash Screens]: {{site.android-dev}}/about/versions/12/features/splash-screen
220203
[launch screen]: {{site.android-dev}}/topic/performance/vitals/launch-time#themed
221204
[pre-warming a `FlutterEngine`]: /add-to-app/android/add-flutter-fragment#using-a-pre-warmed-flutterengine
222-
[Android splash screen sample app]: {{site.repo.samples}}/tree/main/android_splash_screen
223-
[Deprecated Splash Screen API Migration guide]: /release/breaking-changes/splash-screen-migration
224-
[Customizing web app initialization guide]: /platform-integration/web/initialization

0 commit comments

Comments
 (0)