pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 583 forks source link

Cannot open file while is at app data location '/data/data/<app_id>/cache' #324

Closed ncomo11 closed 1 year ago

ncomo11 commented 2 years ago

Expected Behaviour

File should get open in assosiated application

Actual Behaviour

Gives error "File not Found"

Reproduce Scenario (including but not limited to)

Have below plugins: cordova-plugin-file-opener2 3.0.5 "File Opener2" cordova-plugin-camera 4.1.0 "Camera" -> Not sure if this plugin conflicts or not but better to have it

Steps to Reproduce

  1. Programmatically or manually create a file at context.getApplicationInfo().dataDir (i.e. '/data/data//cache') Note: 'context' is cordova context
  2. try to opne above file using plugin call: var filePath = ; var fileMIMEType = 'text/plain'; // file mine type cordova.plugins.fileOpener2.open( filePath, fileMIMEType, { error : function(err){ console.log('error:',err)}, success : function(){ console.log('success')} } );

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android OS 11

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Pixel 3 XL

Cordova CLI info

cordova info

Here is the output: cordova-lib@9.0.1 with: cordova-common@3.2.1 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0

Environment: OS: win32 Node: v12.18.2 npm: 6.14.8

Plugin version

cordova plugin version | grep cordova-plugin-file-opener2

Here is the output: cordova-plugin-camera 4.1.0 "Camera" cordova-plugin-file-opener2 3.0.5 "File Opener2"

Sample Code that illustrates the problem

var filePath = ; var fileMIMEType = 'text/plain'; // file mine type cordova.plugins.fileOpener2.open( filePath, fileMIMEType, { error : function(err){ console.log('error:',err)}, success : function(){ console.log('success')} } );

Logs taken while reproducing problem

Run

adb logcat PluginManager:V CordovaPlugin:V CordovaLog:V chromium:V *:S

while testing the bug in your app to get some output from your error. This will help you to understand more about the nature of your problem.

rohit0009 commented 2 years ago

I am facing this same issue with the latest plugin version

cordova-android version 8.0.0

shnist commented 1 year ago

I believe this is a duplicate of #310