In order to add a splash screen to an Android app built with PhoneGap you have to perform the following steps:
res/drawable-screensize
folder (please refer to the official documentation available at http://developer.android.com/tools/help/draw9patch.html in order to create 9-patch images).The res
folder can contain images, pictures, and so on. Each time a new resource is added to this folder it's automatically defined in the R.java
class as static int
values so that you can access it easily in your app. The drawable
folders are the ones where you can put one image per folder, sized to match the indicated screen density.
Resources/splash
directory. Only add the images for the devices you want to support, such as iPad or iPhone.splash_screen.xml
in the xml
folder containing all the relevant information.<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http: //schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/splash"/>
index.html
file.super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl(Config.getStartUrl());
index.js
file, after the template loading and parsing, you can optionally add the JavaScript needed to hide the splash screen.navigator.splashscreen.hide();
$ cordova plugin add https: //git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
You defined a splash screen that will be visible only until your app is completely ready to run, and displays the UI to the user employing platform-specific settings and the Splashscreen API.
Prepare the assets needed to define the splash screen of your app for all your target platforms. You can get a complete overview of the assets needed for each platform in the online references of each one.
Q1. Which is the recommended cordova-cli command to run to emulate your app on a specific target platform?
serve
.emulate
.ripple
.Q2. What is the main advantage of using the module
pattern in JavaScript?
3.17.79.60