Black screen came for 2 seconds when starting app in phonegap
in android
before the splash screen came. How to resolve this problem? I need splash screen immediately.

- 7,134
- 9
- 47
- 76

- 79
- 1
- 4
-
you test it using device or simulator? – Nurdin Mar 16 '14 at 13:12
-
How are you closing the splashscreen? Using a fixed time or calling `navigator.splashscreen.hide()`? – Andrew Lively Mar 16 '14 at 17:17
4 Answers
You need to create a new theme to the android app.
Under "{Project}\res\values" create a new file "styles.xml" and put the contents of the attached image
In the AndroidManifest.xml add "android:theme="@style/Theme.MyAppTheme"" to the "application" tag

- 125
- 7
-
Please copy the actual contents of the file, as text, into your answer. – HughHughTeotl Jun 11 '15 at 08:13
-
I added the styles.xml file as recommended, and updated application.xml. However it seems that application.xml gets overwritten when making a build (at least when using Ionic.) To get around that I used the cordova-custom-config plugin to add the new theme to config.xml instead, as seen in Kutomer's answer here: http://stackoverflow.com/questions/29490925/change-android-theme-from-cordova-config-xml – Anthony Tietjen Feb 12 '17 at 02:58
-
1To make it easier for the next person, here is a slimmed down text version of George's image.
Simply you can't.
That black screen is a sort of Android internal base screen that Android shows for your app while it fork a process in the Dalvik JVM and load your resources/classes. it happen for any Android app. it is not related to Phonegap. Android make this to give the user the impression of a "fast app launch" while it instead is still loading your code.
Anyway you can style that black screen to make it appear as near as possible to the theme of your app so the user have the impression the app is ready and launched but it is loading internal content.
You can read more about it here: http://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/

- 1,237
- 3
- 18
- 29
I had the same problem. Here's I solved it:
Install the "org.apache.cordova.splashscreen" plugin
Add these lines to your config.xml:
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="SplashScreenDelay" value="10000" />
<gap:plugin name="org.apache.cordova.splashscreen" />
- Change the config.xml's XML namespace from
xmlns:cdv="http://cordova.apache.org/ns/1.0
toxmlns:gap="http://phonegap.com/ns/1.0
, if not done so already.

- 1,445
- 1
- 20
- 36

- 599
- 9
- 21
<resources>
<style name="AppBaseTheme" parent="android:Theme.Light" />
<style name="Theme" parent="android:style/Theme" />
<style name="Theme.MyAppTheme" parent="Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@drawable/screen</item>
</style>
</resources>

- 111
- 1
- 5