-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Need Help: Splashscreen for android 12 using Vue/Capacitor #8169
-
I'm building a Vue/Capacitor app that allows users to input data and generate a PDF. It's a single-page app with 10 input fields, and it's being tested on an emulator via Android Studio.
The issue I'm facing is with the splash screen behavior on Android 12+. When launching the app, I see two splash screens:
The first splash screen shows the app icon centered on a colored background — I believe this is the Android 12 system splash.
After about 10 seconds, it transitions to a completely white screen that lasts another 6–10 seconds before the app finally loads.
I want to remove the second white screen entirely and have the Android 12 splash until the app is ready. The app doesn't use network and should load quickly, so this delay seems excessive.
Here’s my current setup:
AndroidManifest:
`
type
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/Theme.MyApp.Splash"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
`
Styles.xml:
`
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.MyApp.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>
<item name="windowSplashScreenBackground">@color/splash_bg</item>
<item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
</style>
`
MainActivity.java:
`package.com.begginer1app
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
`
Beta Was this translation helpful? Give feedback.