Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
- android:largeHeap="true"
- downloadFile: {
- run: function(uri, fileName, folderName) {
- var that = this;
- filePath = "";
- that.getFilesystem(
- function(fileSystem) {
- console.log("gotFS");
- if (APP.isAndroid()) {
- that.getFolder(
- fileSystem,
- folderName,
- function(folder) {
- filePath = folder.toURL() + "/" + fileName;
- console.log("FILE PATH :::: " + filePath);
- that.transferFile(uri, filePath);
- }, function() {
- console.log("failed to get folder");
- }
- );
- }
- else {
- filePath = fileSystem.root.fullPath + "/" + fileName;
- that.transferFile(uri, filePath);
- }
- },
- function() {
- console.log("failed to get filesystem");
- }
- );
- },
- getFilesystem:function (success, fail) {
- window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, success, fail);
- },
- getFolder: function (fileSystem, folderName, success, fail) {
- fileSystem.root.getDirectory(folderName, {create: true, exclusive: false}, success, fail)
- },
- transferFile: function (uri, filePath) {
- var transfer = new FileTransfer();
- console.log("Trying to DL : : " + encodeURI(uri) + " to " + filePath);
- /** **/
- transfer.download(
- encodeURI(uri),
- filePath,
- function (entry) {
- console.log("TRYING TO OPEN FILE ::: " + entry.toURL());
- },
- function (error) {
- console.log("download error source " + error.source);
- console.log("download error target " + error.target);
- console.log("upload error code" + error.code);
- }
- );
- }
- },
- this.downloadFile.run(url, "file_name.pdf", "pdfs");
- I/chromium(26125): [INFO:CONSOLE(388)] "TRYING TO OPEN FILE ::: cdvfile://localhost/persistent/fileName", source: file:///android_asset/www/app/env.js (388)
- F/libc (26125): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 26203 (GAThread)
- I/DEBUG ( 269): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
- I/DEBUG ( 269): Build fingerprint: 'motorola/falcon_asia_ds/falcon_umtsds:4.4.2/KXB20.25-1.31/14:user/release-keys'
- I/DEBUG ( 269): Revision: 'p3c0'
- I/DEBUG ( 269): pid: 26125, tid: 26203, name: GAThread >>> nz.co.forsythbarr.mobileapp <<<
- I/DEBUG ( 269): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
- D/WifiStateMachine( 1010): handleMessage: E msg.what=151572
- D/WifiStateMachine( 1010): processMsg: ConnectedState
- D/WifiStateMachine( 1010): processMsg: L2ConnectedState
- I/DEBUG ( 269): r0 00000000 r1 00000000 r2 625ca245 r3 00000028
- I/DEBUG ( 269): r4 00000008 r5 625ca246 r6 00000000 r7 ffffffff
- I/DEBUG ( 269): r8 00000001 r9 40b59130 sl 00000028 fp 625ca245
- I/DEBUG ( 269): ip 6402fb34 sp 64a39990 lr 64024105 pc 40b440f6 cpsr 600f0030
- I/DEBUG ( 269): d0 0000000000000000 d1 0000000000000000
- I/DEBUG ( 269): d2 0000000000000000 d3 0000000000000000
- I/DEBUG ( 269): d4 3268053561342f79 d5 796470730830312d
- I/DEBUG ( 269): d6 64707306312e332f d7 7074746808332f79
- I/DEBUG ( 269): d8 0000000000000000 d9 0000000000000000
- I/DEBUG ( 269): d10 0000000000000000 d11 0000000000000000
- I/DEBUG ( 269): d12 0000000000000000 d13 0000000000000000
- I/DEBUG ( 269): d14 0000000000000000 d15 0000000000000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement