Project Settings - PhoneGap 中文文档

返回介绍

Project Settings

发布于 2019-07-04 字数 2567 浏览 807 评论 0

Project Settings

You can set various application configuration parameters using a platform-agnostic configuration file, config.xml.
This file is based on the W3C Packaged Web Apps (Widgets) specification.

The location of the config.xml file is different depending on the platform. The contents, in general, are not.

Platform-Specific Properties

As with any abstraction layer, Apache Cordova cannot be a perfect silver bullet. As such, some native and platform-specific
properties, characteristics and behaviours are encapsulated as much as possible as <preference> elements inside the
config.xml file. The following sub-sections linked to are guides which go into more details about these preferences.

  • Project Settings for iOS
  • Project Settings for Android
  • Project Settings for BlackBerry
  • Project Settings for Windows Phone 7
  • Project Settings for Windows Phone 8
  • Project Settings for Windows 8
  • Project Settings for FirefoxOS

config.xml Elements

The PhoneGap project strives abstract away native platform specifics via web-inspired and web-based
abstractions that are heavily standards driven and adopted by the web community. Please take a few minutes to familiarize
yourself with the config.xml specification, to understand the type of application metadata the
Apache Cordova project aims to abstract and provide simple entry points for.

An example:

    <widget>
<preference name="MySetting" value="true" />
<plugins>
<plugin name="MyPlugin" value="MyPluginClass" />
</plugins>
<access origin="*" />
    </widget>

A list of supported elements across major platforms which are supported in Apache Cordova follow.

<plugin>

These elements map to native APIs that the application accesses. At
runtime, the Apache Cordova framework checks the <plugin> elements
and maps them to native code to enable your Cordova application to
access device APIs otherwise unavailable to typical web-based
applications.

<access>

These elements define how your whitelist works. Please see the
Domain Whitelist Guide for more information.

<content>

This element defines your application’s start page relative to the
project’s standard web assets root folder. The default is
index.html.

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!