{"action":"created","issue":{"url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/60","repository_url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2","labels_url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/60/comments","events_url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/60/events","html_url":"https://github.com/pwlin/cordova-plugin-file-opener2/issues/60","id":133231006,"number":60,"title":"Can't open file in cordova.file.cacheDirectory","user":{"login":"shaoyunli","id":5293345,"avatar_url":"https://avatars.githubusercontent.com/u/5293345?v=3","gravatar_id":"","url":"https://api.github.com/users/shaoyunli","html_url":"https://github.com/shaoyunli","followers_url":"https://api.github.com/users/shaoyunli/followers","following_url":"https://api.github.com/users/shaoyunli/following{/other_user}","gists_url":"https://api.github.com/users/shaoyunli/gists{/gist_id}","starred_url":"https://api.github.com/users/shaoyunli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaoyunli/subscriptions","organizations_url":"https://api.github.com/users/shaoyunli/orgs","repos_url":"https://api.github.com/users/shaoyunli/repos","events_url":"https://api.github.com/users/shaoyunli/events{/privacy}","received_events_url":"https://api.github.com/users/shaoyunli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-12T12:39:08Z","updated_at":"2016-02-13T19:55:28Z","closed_at":null,"body":"I created a temp file \"temp.pdf\" under cordova.file.cacheDirectory and need to open it after it is created. I don't know which kind of file path of cordova.file.cacheDirectory can be accepted by fileOpener2.open. Here is my code. \r\n\r\nprivate openFile(fileName, contentType) {\r\n\r\n        var pathToFile = cordova.file.cacheDirectory + fileName;\r\n\r\n        window.resolveLocalFileSystemURI(pathToFile, (fileEntry: FileEntry) => {\r\n            var filePath = fileEntry.toURL().substring(8);\r\n            // var filePath = fileEntry.fullPath;\r\n            (<ICordovaPlugins>window.cordova.plugins).fileOpener2.open(filePath, contentType, {\r\n                error: (errorObj: any) => {\r\n                    console.log(\"Cannot open file, failed to open the temporary file: \" + errorObj.status + ': ' + errorObj.message);\r\n                },\r\n                success: () => {\r\n                    console.log(fileEntry.fullPath);\r\n                }\r\n            })\r\n        },\r\n            () => {\r\n                console.log(\"Cannot open file, failed to get cache directory.\");\r\n            }\r\n        );\r\n    }\r\n\r\nTo open a file under cordova.file.cacheDirectory, which path does fileOpener2.open expect? \r\n\r\n(1) For fileEntry.toURL(), I got \"file:///data/data/AppID*****/cache/temp.pdf\"\r\n(2) For fileEntry.fullPath, I got \"/temp.pdf\"\r\n(3) For fileEntry.toInternalURL(), I got \"cdvfile://localhost/cache/temp.pdf\"\r\n\r\nI have tired all of the paths above, none of them can open the temp file which was created successfully. Is cordova.file.cacheDirectory an internal location rather than an external location so that the file cannot be open from this location using fileOpener2? "},"comment":{"url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/comments/183742761","html_url":"https://github.com/pwlin/cordova-plugin-file-opener2/issues/60#issuecomment-183742761","issue_url":"https://api.github.com/repos/pwlin/cordova-plugin-file-opener2/issues/60","id":183742761,"user":{"login":"pwlin","id":160443,"avatar_url":"https://avatars.githubusercontent.com/u/160443?v=3","gravatar_id":"","url":"https://api.github.com/users/pwlin","html_url":"https://github.com/pwlin","followers_url":"https://api.github.com/users/pwlin/followers","following_url":"https://api.github.com/users/pwlin/following{/other_user}","gists_url":"https://api.github.com/users/pwlin/gists{/gist_id}","starred_url":"https://api.github.com/users/pwlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwlin/subscriptions","organizations_url":"https://api.github.com/users/pwlin/orgs","repos_url":"https://api.github.com/users/pwlin/repos","events_url":"https://api.github.com/users/pwlin/events{/privacy}","received_events_url":"https://api.github.com/users/pwlin/received_events","type":"User","site_admin":false},"created_at":"2016-02-13T19:55:28Z","updated_at":"2016-02-13T19:55:28Z","body":"What if you try to open a file in `/sdcard/Downloads/` directory. Does that work for you?"}}