@capacitor/splash-screen
The Splash Screen API provides methods for showing or hiding a Splash image.
Install
npm install @capacitor/splash-screen
npx cap sync
Android 12 Splash Screen API
This only affects the launch splash screen and is not used when utilizing the programmatic show() method.
Capacitor 4 uses the Android 12 Splash Screen API and the androidx.core:core-splashscreen compatibility library to make it work on Android 11 and below.
The compatibility library can be disabled by changing the parent of AppTheme.NoActionBarLaunch from Theme.SplashScreen to AppTheme.NoActionBar in android/app/src/main/res/values/styles.xml.
The Android 12 Splash Screen API can't be disabled on Android 12+ as it's part of the Android OS.
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">@drawable/splash</item>
</style>
NOTE: On Android 12 and Android 12L devices the Splash Screen image is not showing when launched from third party launchers such as Nova Launcher, MIUI, Realme Launcher, OPPO Launcher, etc., from app info in Settings App, or from IDEs such as Android Studio. Google Issue Tracker Google Issue Tracker Google has fixed those problems on Android 13 but they won't backport the fixes to Android 12 and Android 12L. Launcher related issues might get fixed by a launcher update. If you still find issues related to the Splash Screen on Android 13, please, report them to Google.
Example
import { SplashScreen } from '@capacitor/splash-screen';
// Hide the splash (you should do this on app launch)
await SplashScreen.hide();
// Show the splash for an indefinite amount of time:
await SplashScreen.show({
autoHide: false,
});
// Show the splash for two seconds and then automatically hide it:
await SplashScreen.show({
showDuration: 2000,
autoHide: true,
});