Splash screen unexpectedly reappears when returning from background after using share_plus
Attention: If you open a bug report without sufficient details, it will be closed. Is your question related to Android 12? Please check the notes on Android 12 first (https://pub.dev/packages/flutter_native_splash#android-12-support).
Describe the bug
When using share_plus to share a URL, it invokes startActivityForResult(pendingIntent, ...) and displays a bottom sheet with various SNS icons.
However, if I move the app to the background and then bring it back to the foreground, the splash screen briefly reappears without drawable icons for a few seconds. I expected to return directly to the previous screen without the splash screen appearing again.
Configuration
flutter_native_splash:
color: "#13443b"
image: assets/pngs/splash.png
color_dark: "#13443b"
image_dark: assets/pngs/splash.png
android: true
ios: true
web: false
android_12:
color: "#13443b"
image: assets/icons/android_logo.png
color_dark: "#13443b"
image_dark: assets/icons/android_logo.png
icon_background_color: "#13443b"
ios_content_mode: scaleAspectFill
// AndroidManifest
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:turnScreenOn="true"
android:fullBackupContent="@xml/backup_rules"
android:screenOrientation="portrait">
Device (please complete the following information):
- Device: Android Emulator
- OS: Android 13 (API 33)
To Reproduce Steps to reproduce the behavior, using the example app:
- Call the share function using
share_plus. share_plusexecutes startActivityForResult(pendingIntent, ...) and displays a bottom sheet with SNS icons.- Move the app to the background.
- Return the app to the foreground.
- The splash screen unexpectedly reappears for a few seconds.
Expected behavior The app should return directly to the previous screen without showing the splash screen when coming back from the background.
Screenshots
Additional context Log output when moving from background to foreground:
D/SplashScreenView(22626): Building from parcel drawable: null
D/SplashScreenView(22626): Build android.window.SplashScreenView{2aa79e5 V.E...... ......ID 0,0-0,0}
D/SplashScreenView(22626): Icon: view: null drawable: null size: 0
D/SplashScreenView(22626): Branding: view: android.view.View{fd7dcba G.ED..... ......I. 0,0-0,0 #10204db android:id/splashscreen_branding_view} drawable: null size w: 0 h: 0
I/flutter (22626): [...Cubit] load
...
D/SplashScreenView(22626): remove starting view
...
The operating system determines when the splash screen is displayed. This package can only configure the appearance of the splash screen and optionally keep the splash screen displayed until it is specifically removed. So unfortuantly there is no way for this package to prevent the splash screen from being displayed in your case.