Cordova - 无法触发Android让我选择要上传的图片

问题描述 投票:0回答:1

我正在使用Cordova包装第三方iframe。在iframe中有一个上传按钮。它适用于iOS,我可以选择要上传的照片(见下面的截图)。

enter image description here

在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" />
  • 我在config.xml中缺少特定的allow-intent吗?我目前的设置如下:
  <allow-intent href="https://*.mydomain.com.*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>
  • 我是否需要安装额外的Cordova插件?
android cordova ionic-framework hybrid-mobile-app
1个回答
0
投票

经过进一步调查后,我意识到这不是权限问题。

当我手动将第三方上传按钮HTML更改为<input type="file" />时,它可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.