<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0" />
<title>Sample</title>
<script src="cordova-2.7.0.js" type="text/javascript"></script>
<script type="text/javascript">
if (!navigator.userAgent.toLowerCase().match('chrome')) {
document.write("<script src='phonegap.js'><\/script>");
}
</script>
</head>
<body onload="onLoaded()">
<div class="info" style="font-size:12px">CCN TEST</div>
<script>
function onLoaded() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, onGetTmpFileSystemSuccess, onGetTmpFileSystemError);
}
function onGetTmpFileSystemSuccess(fileSystem){
var paths=fileSystem.root.fullPath.split("/");
var fullPath="file:///mnt/sdcard/Android/data/"+paths[paths.length-2];
alert(fullPath);
window.resolveLocalFileSystemURI(fullPath, onGetLocalFileSystemURISuccess, onGetLocalFileSystemURIError);
alert('GetTmpFileSystemSuccess');
}
function onGetTmpFileSystemError(fileSystem){
alert('GetTmpFileSystemError');
}
function onGetLocalFileSystemURISuccess(fileSystem){
fileSystem.getDirectory("app_newDir",{create:true, exclusive:false}, onCreateSuccess, onCreateError);
alert('GetLocalFileSystemURISuccess');
}
function onGetLocalFileSystemURIError(err){
alert('不能獲取指定檔目錄:'+err.code);
}
function onCreateSuccess(parent){
alert('成功建立目錄,路徑是:'+parent.fullPath);
}
function onCreateError(err){
alert('沒有成功建立目錄:'+err.code);
}
</script>
</body>
</html>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 amychang2014 的頭像
    amychang2014

    工作需要筆記

    amychang2014 發表在 痞客邦 留言(0) 人氣()