- PhoneGap By Example
- Andrey Kovalenko
- 342字
- 2021-07-16 20:36:38
The config.xml structure
Before proceeding to consider the specific settings for each mobile platform, let's look at the common configuration file config.xml
. This file contains very important information on setting up our future applications.
By default, our config.xml
file has the following contents:
<?xml version='1.0' encoding='utf-8'?> <widget id="com.cybind.travelly" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Travelly</name> <description> A sample Apache Cordova application that responds to the deviceready event. </description> <author email="dev@cordova.apache.org" > Apache Cordova Team </author> <content src="index.html" /> <access origin="*" /> </widget>
Where:
- Widget: It's ID attribute provides the app's reverse-domain identifier, and the version provides its full version number.
- Name: This specifies the app's formal name as it appears on the device's home screen and within app-store interfaces.
- Description and author: This specifies metadata and contact information that may appear within app-store listings.
- Content: This optional element defines the app's starting page in the top-level web assets directory.
- Access: This defines the set of external domains the app is allowed to communicate with. In our case, we allow it to access any server.
Furthermore, there can be other options presented. Usually, they are added under the tag access. These elements are preference
and feature
.
Preference items can be global and multiplatform.
For example, the following two settings are global and apply to all supported platforms:
<preference name="Fullscreen" value="true" /> <preference name="Orientation" value="landscape" />
Where:
Fullscreen
allows you to hide the status bar at the top of the screenOrientation
allows you to lock orientation and prevent the interface from rotating in response to changes in orientation
The following two settings apply to multiple platforms, but not all:
<preference name="TopActivityIndicator" value="gray" /> <preference name="AutoHideSplashScreen" value="false" />
Where:
TopActivityIndicator
sets the color of the Activity IndicatorAutoHideSplashScreen
specifies whether to hide the splash screen automatically or allow the programmer to do it in code
In this case, it is not necessary to add feature elements manually, because in the initial stage, we will use the cross-platform workflow, where we will use the command CLI plugin to add the device API. However, when we move to fine-tuning of each platform, we will add the feature elements, as shown in this example:
<feature name="Device"> <param name="ios-package" value="CDVDevice" /> </feature> <feature name="Device"> <param name="android-package" value="org.apache.cordova.device.Device" /> </feature>
- Java面向?qū)ο笏枷肱c程序設(shè)計(jì)
- Rake Task Management Essentials
- JIRA 7 Administration Cookbook(Second Edition)
- Web Development with Django Cookbook
- C語(yǔ)言程序設(shè)計(jì)教程(第2版)
- Python應(yīng)用輕松入門(mén)
- Python機(jī)器學(xué)習(xí)編程與實(shí)戰(zhàn)
- Go并發(fā)編程實(shí)戰(zhàn)
- Java:High-Performance Apps with Java 9
- Natural Language Processing with Java and LingPipe Cookbook
- RubyMotion iOS Develoment Essentials
- Java EE實(shí)用教程
- Raspberry Pi開(kāi)發(fā)實(shí)戰(zhàn)
- 數(shù)據(jù)庫(kù)基礎(chǔ)與應(yīng)用實(shí)驗(yàn)教程:Visual FoxPro 6.0
- Twitter Bootstrap Web Development How-to