Is that possible to add animated splash screens for Android and iOS Phonegap apps? I tried to add animated .gif as splash screen file for Android but it doesn't work. I.e. there is no animation, the only thing I can see is first frame of the .gif.
And also is there a way to add dynamic text somewhere at splash screen? Actually this is what I want. And to use .gif is just my assumption how can I do it in the easiest way. So, if you can give me example of working cod for iOS and Android dynamic splash screens with Phonegap it will be even better.
gif animations are not supported on Android. Animations are possible using jQuery. This is what you can do
setTimeout('functionToLoadNewPage', 2000);
//functionToLoadNewPage - function name which will load a new page using $.mobile.changePage and 2000 - number of milliseconds for splash screen to be visible
I've been searching, and I think that you should create a javascript-android interface and do something like Cordova does.
This is the Cordova code:
public class SplashScreen extends Plugin {
@Override
public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
if (action.equals("hide")) {
this.webView.postMessage("splashscreen", "hide");
} else if (action.equals("show")){
this.webView.postMessage("splashscreen", "show");
}
else {
status = PluginResult.Status.INVALID_ACTION;
}
return new PluginResult(status, result);
}
And it is invoked throught javascript like this:
exec(null, null, "SplashScreen", "show", []);
Also you will need to do it for iOS too, see this link: ios fade out splash screen (iphone 5 friendly)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With