help
@xiaozhicheng , please provide more detailed information about this issue, thanks.
The problem occurred on the Android 7 model,
installing Apk times wrong: android.os.FileUriExposedException:, file://xxxxx.apk, exposed, beyond, app, through, Intent.getData ()
This could be a result of how RNFB uses PathResolver.getRealPathFromURI and the new File API to read files from common filesystem document providers instead of using getContentResolver().openInputStream(uri).
@wkh237 In this context, is it possible this function is wrong?
It is
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data)
but if I see this right it should be
public void onActivityResult(int requestCode, int resultCode, Intent data)
Reference: https://developer.android.com/training/basics/intents/result.html
That change also satisfies Android studio, which complains about that method. It also complains about the empty onNewIntent just below ("Method does not override method from its superclass").
I don't want to change anything in the "fetch" part of the code, I only do filesystem (fs.methods)...
I am just doing android.actionViewIntent(res.path(), 'image/png')( where res.path() returns '/storage/emulated/0/Download/CatHat1.jpg' ) and it is giving me this error . Full stack trace of error :
Possible Unhandled Promise Rejection (id: 0):
Error: file:///storage/emulated/0/Download/CatHat1.jpg exposed beyond app through Intent.getData()
Error: file:///storage/emulated/0/Download/CatHat1.jpg exposed beyond app through Intent.getData()
at createErrorFromErrorData (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1787:15)
at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1744:25
at MessageQueue.__invokeCallback (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2097:16)
at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1890:15
at MessageQueue.__guard (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2028:9)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1889:13)
at http://localhost:8081/debuggerWorker.js:72:58
Is any workaround or any kind of solution to this problem possible? If yes then please tell me as and when possible. I just want to open the downloaded file in its default file opener.
Update , This is not working on android N(7.0) only. It worked fine in 6.0. So i think whatever @sagar-teallabs and @dantman have written is the ultimate problem . Does anyone have a workaround or solution to this?
Check https://github.com/wkh237/react-native-fetch-blob/pull/614 , the problem is fixed.
Most helpful comment
This could be a result of how RNFB uses
PathResolver.getRealPathFromURIand thenew FileAPI to read files from common filesystem document providers instead of usinggetContentResolver().openInputStream(uri).