mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
Combining plugins.xml and cordova.xml to make config.xml
This commit is contained in:
parent
2eb4c5e960
commit
b486711d68
54
framework/res/xml/config.xml
Normal file
54
framework/res/xml/config.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
<cordova>
|
||||||
|
<!--
|
||||||
|
access elements control the Android whitelist.
|
||||||
|
Domains are assumed blocked unless set otherwise
|
||||||
|
-->
|
||||||
|
|
||||||
|
<access origin="http://127.0.0.1*"/> <!-- allow local pages -->
|
||||||
|
|
||||||
|
<!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
|
||||||
|
<!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
|
||||||
|
<!-- <access origin=".*"/> Allow all domains, suggested development use only -->
|
||||||
|
|
||||||
|
<log level="DEBUG"/>
|
||||||
|
<preference name="useBrowserHistory" value="false" />
|
||||||
|
<plugins>
|
||||||
|
<plugin name="App" value="org.apache.cordova.App"/>
|
||||||
|
<plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
|
||||||
|
<plugin name="Device" value="org.apache.cordova.Device"/>
|
||||||
|
<plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
|
||||||
|
<plugin name="Compass" value="org.apache.cordova.CompassListener"/>
|
||||||
|
<plugin name="Media" value="org.apache.cordova.AudioHandler"/>
|
||||||
|
<plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
|
||||||
|
<plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
|
||||||
|
<plugin name="File" value="org.apache.cordova.FileUtils"/>
|
||||||
|
<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
|
||||||
|
<plugin name="Notification" value="org.apache.cordova.Notification"/>
|
||||||
|
<plugin name="Storage" value="org.apache.cordova.Storage"/>
|
||||||
|
<plugin name="Temperature" value="org.apache.cordova.TempListener"/>
|
||||||
|
<plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
|
||||||
|
<plugin name="Capture" value="org.apache.cordova.Capture"/>
|
||||||
|
<plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
|
||||||
|
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
|
||||||
|
</plugins>
|
||||||
|
</cordova>
|
||||||
|
|
@ -596,7 +596,12 @@ public class CordovaWebView extends WebView {
|
|||||||
* <log level="DEBUG" />
|
* <log level="DEBUG" />
|
||||||
*/
|
*/
|
||||||
private void loadConfiguration() {
|
private void loadConfiguration() {
|
||||||
int id = getResources().getIdentifier("cordova", "xml", this.cordova.getActivity().getPackageName());
|
int id = getResources().getIdentifier("config", "xml", this.cordova.getActivity().getPackageName());
|
||||||
|
if(id == 0)
|
||||||
|
{
|
||||||
|
id = getResources().getIdentifier("cordova", "xml", this.cordova.getActivity().getPackageName());
|
||||||
|
Log.i("CordovaLog", "config.xml missing, reverting to cordova.xml");
|
||||||
|
}
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
LOG.i("CordovaLog", "cordova.xml missing. Ignoring...");
|
LOG.i("CordovaLog", "cordova.xml missing. Ignoring...");
|
||||||
return;
|
return;
|
||||||
|
@ -92,9 +92,16 @@ public class PluginManager {
|
|||||||
* Load plugins from res/xml/plugins.xml
|
* Load plugins from res/xml/plugins.xml
|
||||||
*/
|
*/
|
||||||
public void loadPlugins() {
|
public void loadPlugins() {
|
||||||
int id = this.ctx.getActivity().getResources().getIdentifier("plugins", "xml", this.ctx.getActivity().getPackageName());
|
int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
|
||||||
|
if(id == 0)
|
||||||
|
{
|
||||||
|
id = this.ctx.getActivity().getResources().getIdentifier("plugins", "xml", this.ctx.getActivity().getPackageName());
|
||||||
|
LOG.i(TAG, "Using plugins.xml instead of config.xml. plugins.xml will eventually be deprecated");
|
||||||
|
}
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
this.pluginConfigurationMissing();
|
this.pluginConfigurationMissing();
|
||||||
|
//We have the error, we need to exit without crashing!
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
|
XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
|
||||||
int eventType = -1;
|
int eventType = -1;
|
||||||
@ -361,9 +368,9 @@ public class PluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pluginConfigurationMissing() {
|
private void pluginConfigurationMissing() {
|
||||||
System.err.println("=====================================================================================");
|
LOG.e(TAG, "=====================================================================================");
|
||||||
System.err.println("ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.");
|
LOG.e(TAG, "ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.");
|
||||||
System.err.println("https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml");
|
LOG.e(TAG, "https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml");
|
||||||
System.err.println("=====================================================================================");
|
LOG.e(TAG, "=====================================================================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user