Closed imgx64 closed 6 years ago
Can you submit a PR for that? I'd like to test it.
PR in #176
thank you, i have problems opening files on Android < 6.0, a new versione of the plugin will be released?
I'm also facing the problem @skar3 reported. Here is the error in the build process:
Error: /home/mlearn/Documentos/mLearn/app/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/home/mlearn/Documentos/mLearn/app/platforms/android/src/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java:110: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
^
symbol: variable N
location: class VERSION_CODES
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Can you help?
@gutosoares Install the latest Android SDK and upgrade your app to use the latest cordova-android
version.
Fixed by #176.
Looking at the code, it seems that FileProvider is only used on Android API >= 23 (Marshmallow). This prevents opening files in private app directories (such as /data/data/app-id/files/*) in other apps on Android 5 and earlier.
I modified the plugin to always use FileProvider and it worked correctly on Android 4.1 (The earliest version supported by Cordova). And as a bonus,
android.permission.WRITE_EXTERNAL_STORAGE
is no longer required.Is there a reason it's this way? Can it be changed?