'Hiding Android Splash screen in Capacitor Ionic/Ionic React
I'm having issues with the Ionic Capacitor Splashscreen. I've tried to use the official documentation which can be found here. However none of the examples in the documentation seem to run at all for me.
Just an example of what I've tried is this bit of code inside my capacitor.config.json:
"plugins": {
"SplashScreen": {
"launchShowDuration": 10000,
"backgroundColor": "#ff00ff"
}
}
The app behaves exactly as it did prior, which is probably the default setting (splash showing for 3 seconds after which the app loads).
I have also tried to disable autohide among other things, but none of the code seems to actually do much of anything, the app still runs as it did before. Any ideas?
Solution 1:[1]
You can use Plugins.SplashScreen.hide
method of Capacitor, I explained it in this answer : https://stackoverflow.com/a/62063934/6695569.
Solution 2:[2]
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
});
https://capacitorjs.com/docs/apis/splash-screen?#example
Note : if you use your device check your wifi if the same with your laptop
´ionic capacitor run android -l --host=**192.168.X.XX**´ <br>
´ionic capacitor run android -l --host=**ADDRESS_IP**´
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stephane L |
Solution 2 | Moustaoui Salaheddine |