我正在使用Cordova包装第三方iframe。在iframe中有一个上传按钮。它适用于iOS,我可以选择要上传的照片(见下面的截图)。
在Android上虽然没有任何反应,当我点击上传按钮时,应该提示用户打开图库来选择文件。
控制台中没有错误,但我在LogCat中发现了这个错误: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 }
那个错误告诉我the device has no applications installed that are able to handle that particular implicit intent。但为什么不能使用默认的照片或文件应用程序?当我尝试使用移动浏览器上传图像时,文件应用程序正确显示。
我怎么解决?
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<allow-intent href="https://*.mydomain.com.*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
经过进一步调查后,我意识到这不是权限问题。
当我手动将第三方上传按钮HTML更改为<input type="file" />
时,它可以正常工作。