Status Update
Comments
al...@google.com <al...@google.com>
ca...@google.com <ca...@google.com> #2
Information redacted by Android Beta Feedback.
ca...@google.com <ca...@google.com>
li...@gmail.com <li...@gmail.com> #3
Just our of curiosity: why have you decided to avoid dependency on AppCompat?
AFAIK the new Android 12 splash screen may appear before ANY activity during cold launch. For instance, if application was killed by OS while being minimized and then user returned to it via "recent apps" menu. To support splash screen backport devs will have to add installSplashScreen
call into every activity and modify theme of every activity to extend Theme.SplashScreen
. If existing activities have n
custom themes devs will have to create n
Theme.SplashScreen
inheritors.
Adopting appcompat this can be avoided:
- Instead of adding
installSplashScreen
into every activity this call can be made by AppCompat. You could expose some kind of splash screeninstantiator
and pass it toAppCompatActivity
through the theme attribute. Just likematerial components
do it using theviewInflaterClass
attribute; - Instead of creating new
Theme.SplashScreen
all modifications could've been done to the existingAppCompat
themes; - Given previous point there will be no need to change themes of all activities in order to support the minimize-die-restore scenario, described above.
You could at least provide an option to integrate with AppCompat
more seamlessly. Something like androidx.splashscreen-appcompat
dependency.
Am I missing something? Are any improvements towards the integration process planned?
Description
Component used:androidx.core:core-splashscreen Version used:1.0.0-alpha02 Devices/Android versions reproduced on: Emulator / Pixel 3XL with Android 12.
Trying to migrate to the splashscreen library but I cant get the documentation and the seemingly intended functionality to make sense.
I define the splash theme and declare it as the theme in the application manifest. My app has multiple entry points based on notification clicks, widget interactions, etc. Placing the call to
installSplashScreen()
in only the launcher activity makes the app crash whenever a different activity is launched instead, either from external sources (widget, notifications) or if navigating to a different activity within the app:The only way I've found to make the splash screen API work is if I add a call to
installSplashScreen()
in every activity's onCreate() methods throughout the app.I presume that's not the intended behavior but I'm not sure how else it's supposed to work?