2015-01-10 2 views
0

meteorJS 웹 애플리케이션 개발 경험이 있지만 Cordova/하이브리드 앱 개발을 시작하는 중입니다. 어떻게 하나 유성 애플 리케이션에서 안드로이드 파일 시스템에 액세스 할 것이라고? 기기의 그림이나 미디어 파일 목록을 유성 템플릿의 사용자에게 표시하고 싶으면 어떻게 그 파일이나 그 파일의 경로를 가져올 수 있습니까?유성 앱에서 android 파일 시스템에 액세스하는 방법은 무엇입니까?

+0

http://stackoverflow.com/questions/8298124/list-files-inside-www-folder-in-phonegap – Nimir

+0

그 파일을 읽는 방법에 대한 질문에 대답합니다. 하지만 파일을 유성으로 가져 오는 방법을 알고 싶습니다. –

답변

0

유성에 대한 List files inside www folder in PhoneGap에서 답을 수정 :

if (Meteor.isCordova) { 
Meteor.startup(function() { 
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { 
     fileSystem.root.getDirectory("Download", { 
      create: true 
     }, function(directory) { 

      var directoryReader = directory.createReader(); 
      directoryReader.readEntries(function(entries) { 
       var i; 
       for (i=0; i<entries.length; i++) { 
        console.log(entries[i].name); 
        var fileName = (entries[i].name); 
        var fullPath = (entries[i].fullPath); 
        var fileItem = { 
         name: fileName, 
         path: fullPath 
        }; 
        Files.insert(fileItem); // inserts files into a mongo collection named "Files" 
       } 

      }, function (error) { 
       alert(error.code); 
      }); 

     }); 
    }, function(error) { 
     alert("can't even get the file system: " + error.code); 
    }); 
}); 

}

+0

파일 이름 및 경로와 같은 이미지 메타 데이터가 표시되지만 실제 이미지를로드 할 수 없습니다. 에 경로를 넣으려고했지만 이미지가로드되지 않습니다. –

관련 문제