question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No splashscreen for home/launcher app + unable to reshow splashscreen

See original GitHub issue

Bug Report

Problem

Upgrading to cordova-android@11 and the new splashscreen system comes with 2 regressions in my app:

  1. Android does not seem to use the splashscreen API for home/launcher app (tested in system-images;android-31;default;x86_64), which result in splashscreen completely missing in my app; there is no redraw on screen until my app closes the splashscreen
  2. there is no no way to reshow the splashscreen; this is a bummer as the previous splashscreen system was a very convenient interstitial screen to use while the app was reloading

To reproduce:

  1. create a new app
  2. add cordova-android@11 platform
  3. use preferences:
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="RemoveSplashScreenOnPause" value="false" />
  1. add utility button in www/index.html:
<button id="splashscreen-button">Show splashscreen</button>
  1. edit www/js/index.js:
function showTemporarySplashscreen() {
    navigator.splashscreen.show();
    setTimeout(() => navigator.splashscreen.hide(), 3000);
}

function onDeviceReady() {
    ...
    setTimeout(() => navigator.splashscreen.hide(), 3000);
    document.getElementById('splashscreen-button').addEventListener('click', showTemporarySplashscreen, false);
}
  1. edit activity in platforms/android/app/src/main/AndroidManifest.xml:
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

What is expected to happen?

  1. splashscreen is always displayed at startup
  2. it is possible to reshow the splashscreen at runtime

What does actually happen?

When starting the app from the app drawer, the splashscreen is displayed. But when installing the app as the default launcher, killing the app, and restarting, one can see no splashscreen is displayed by Android.

Also the inability to reshow the splashscreen is a real regression IMO. I understand the limitation of the new SplashScreen API, but maybe it would have been better to design the new cordova splaschreen system as a complement to the legacy system, with opt-in capability for the legacy system, instead of fully replacing the legacy system with loss of functionality.

Version information

  • cordova-android@11
  • Android 12 (emulator: system-images;android-31;default;x86_64)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
goffioulcommented, Jul 28, 2022

The legacy system as already explained above is incompatible with the Android’s splashscreen API. The best this can reach us is having 2 splashscreens (one from native android which will be unavoidable, and the one from the old cordova splashscreen plugin) where you can only control the splashscreen plugin’s splashscreen. An example of this could be seen if you ran a cordova-android@10 app on an Android 12 device/emulator.

The splashscreen plugin has been updated to not install on cordova-android@11, because they both clobbers the same namespaces and cause conflicts. Some preferences are reused, but outside of that, if similar behaviour is wanted, I suppose a workaround is to fork the splashscreen plugin, and change the namespaces / JS clobber points so that you have access to both cordova-android@11 splashscreen APIs as well as the legacy splashscreen APIs. But I don’t see this being a supported feature at an Apache level.

Thanks for the extensive response. We can just agree to disagree, but I wouldn’t say the legacy system is incompatible with the Android 12 spashscreen API. It could be seen as complementary. Given the limitation of that new API, I would have prefered to see cordova-android embracing the new API as a separate feature, instead of clobbering the existing legacy system and making it completely incompatible. I don’t see the potential double splashscreen as a serious/blocking issue. This would have been less disruptive for app developers.

Regarding splashscreen drawing issues, there is are bugs in the android emulator surrounding drawing the splashscreen. It’s noted in our documentation.

The problem I see is different than the one described in the doc. But it may still be a bug in the emulator, though.

0reactions
jcesarmobilecommented, Nov 25, 2022

For me the splash screen is appearing on android 13, but I only build regular apps, not launcher apps. If it doesn’t work there you should report it to google so maybe they fix it in a future 13.x release or 14.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android skipping the splash screen when re-opening the app ...
When the user then taps the app icon on the HOME screen or taps on the app's task in the list of recent...
Read more >
Splash screen doesn't disappear · Issue #71 - GitHub
It works fine so far (no updates, nothing new), but splash screen now doesn't disappear, no error in build. If I remove [Splashscreen...
Read more >
Apps not Launching/ stuck on splash screen : r/android_beta
I keep restarting it, and even shut it down from the bootloader, but it doesn't stop. Update: My phone just got the 2.1...
Read more >
"De-bloating" the Chromecast with Google TV. Let's get rid of ...
Go to Settings > All Apps > "See All apps" > "Show System apps" > Google > click on "Uninstall Updates" & "Disable"....
Read more >
Notifications Overview | Android Developers
A notification is a message that Android displays outside your app's UI to provide ... Starting with Android 8.0, users can choose to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found