Android 位于“config.xml”下。 <body onload="onLoad();"> <script type="text/javascript"> // Init when we're good and r
位于“config.xml”下。Android 位于“config.xml”下。 <body onload="onLoad();"> <script type="text/javascript"> // Init when we're good and r,android,apache,cordova,Android,Apache,Cordova,位于“config.xml”下。 <body onload="onLoad();"> <script type="text/javascript"> // Init when we're good and ready. function onLoad(){document.addEventListener('deviceready', init, true);} // Init :) functio
<body onload="onLoad();">
<script type="text/javascript">
// Init when we're good and ready.
function onLoad(){document.addEventListener('deviceready', init, true);}
// Init :)
function init(){
// window.requestFileSystem is recognized, so far so good.
window.requestFileSystem(1, 0, function(fileSystem){
alert('success');
}, function(e){
// 'e' is an object, {code: 'Class not found'}
alert('Error accessing local file system');
});
}
</script>
<div class="app">
<h1>Apache Cordova</h1>
...
</div>
<script type="text/javascript" src="cordova.js"></script>
</body>
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.fwd.cwptakeonsheetsv1" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>CWPTakeOnSheetsV1</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="File">
<param name="android-package" value="org.apache.cordova.file" />
<param name="android-package" value="org.apache.cordova.file.FileUtils" />
<param name="onload" value="true" />
<param name="android-package" value="org.apache.cordova.FileUtils" />
</feature>
<feature name="FileTransfer">
<param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
</feature>
</widget>
/**
* Request a file system in which to store application data.
* @param type local file system type
* @param size indicates how much storage space, in bytes, the application expects to need
* @param successCallback invoked with a FileSystem object
* @param errorCallback invoked if error occurs retrieving file system
*/
var requestFileSystem = function(type, size, successCallback, errorCallback) {
argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
var fail = function(code) {
errorCallback && errorCallback(new FileError(code));
};
if (type < 0) {
fail(FileError.SYNTAX_ERR);
} else {
// if successful, return a FileSystem object
var success = function(file_system) {
if (file_system) {
if (successCallback) {
// grab the name and root from the file system object
var result = new FileSystem(file_system.name, file_system.root);
successCallback(result);
}
}
else {
// no FileSystem object returned
fail(FileError.NOT_FOUND_ERR);
}
};
// The error happens in exec()
exec(success, fail, "File", "requestFileSystem", [type, size]);
}
};
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />