Hey @rafaellop, I was under the impression from the Cordova 3.6 documentation (http://cordova.apache.org/docs/en/edge/config_ref_images.md.html) and DevGirl’s blogpost that if you define the splash screens within the config.xml file, Cordova would copy them to the correct platform/android/res folder.
Are you saying that’s not the case?
As what filename should I copy the files to the platform/android/res folder? As screen.png?
Add your splash screen in respective drawable folder to match for all density devices.
and dont mention the value screen.png in preference.mention as like .(make sure your value is the file name of your splash image)
@Thamil so you’re also saying do not use <platform name="android"><splash src="res/screen..." /> tags, but just copy them to the drawable folders in /platform/android/res?
That’s not the way it’s supposed to work in 3.6. You’re supposed to be able to configure the splash screen through config.xml as described in the online docs, and in fact, I can build my Ionic project and see the splash screens being copied to res/drawable-XXXX/screen.png, they’re just not used. I can configure iOS splash screens through config.xml and they work fine; the problem is specific to Android. I’m going to see if I can figure out what’s going on, and if I can’t, I’ll ask over on the Phonegap/Cordova mailing list.
I’ll certainly try that myself. I have signed an Apache Foundation CLA and have volunteered to update the docs, and this should probably be my first edit. But this is something that needs to be consistent across platforms. Also, I have 9-patch images. The files are named blahblahblah.9.png, not blahblahblah.png. I am wondering if this will be a problem.
Removing the extensions didn’t work for me. 9-patch images need to have the extension .9.png and my source files, which I refer to in my config.xml, do have that extension but they get copied into the Android platform directories as “screen.png” which will not work. When I have some time, I’m going to try using regular PNGs instead and see what happens
MMmmmmkay. You know what, I can configure Android splash screens in config.xml if they aren’t 9-patch images. The build script creates files called screen.png - and I’d forgotten that when I was manually placing the splashscreen images into the Android drawable directories, I used splash.png as the filename and had this entry in config.xml:
<preference name="SplashScreen" value="splash" />
When I changed the entry to
<preference name="SplashScreen" value="screen" />
I was fine. But there are two problems with this:
Whether or not the files are 9-patch files, they get copied into the drawable directories with a .png extension, and to be recognized as 9-patch files, the extension must be .9.png.
If the value of the SplashScreen preference is, say, “Splash”, when the Android build scripts copy the files into the drawable directories, they should be named splash.png.
So - The extension is being ignored, and if you don’t use “screen” as your filename, the filename is being ignored too. I would like to open a bug on the Cordova project’s JIRA, and create a patch that will make the build scripts behave the way they should. I’m having a little trouble finding the appropriate script, so I’ll probably have to reach out to the Cordova mailing list to get some help.
Yes, I’m working on it, need to see if a bug has been opened, and open it if not; but I am buried right now, so for now, I recommend generating those images and placing them directly into the appropriate directories under projectname/platforms/android.
@sjsobol you mentioned that your .9.png files get renamed during the build. I suspect that this is how you have your build hook configured, as I don’t think it’s part of the cordova build itself. Just a suggestion.
I compiled the advice in this thread, and numerous others, and created a blog post detailing how I got my 9-patch splash screen working on android:
Hope it helps someone, let me know if I’ve left out any important details.