In my Cordova project I rely on a third party dependency that uses ng-file-upload in order to upload files.
It works on iOS but not on Android as reported in this issue on their Github.
The old issue had been closed because the following solutions were available:
https://github.com/apache/cordova-plugin-file-transfer#deprecated => NOW DEPRECATED
Crosswalk => NOW DEPRECATED
How can I solve this? The HTTP request is not sent at all.
Additional info:
No activity found to handle file chooser intent.:
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.GET_CONTENT cat=
[android.intent.category.OPENABLE] typ=.jpg,.png,.tiff,.jpeg,.tif,.pdf }
Explanation of the log:
The error is telling you that the device has no applications installed that are able to handle that particular implicit intent.
-> that is not the case though
- It does not seem to be a permissions issue:
The (Cordova) Android App works when for the upload button I use
<input type="file" />
in place of the ng-file-upload directive.
( we already provide all the required permissions: )
<custom-config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</custom-config-file>
I am whitelisting everything in my config.xml for cordova: access, allow-navigation, allow-intent, CSP. Still no luck.
We don't have control over the Android code (unless we write a custom plugin). Would this native code solve the issue?
MyWebviewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
MyWebviewSettings.setJavaScriptEnabled(true);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setAllowFileAccessFromFileURLs(true);
myWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);