【问题标题】:Cordova - Unable to trigger Android to let me choose an image to uploadCordova - 无法触发 Android 让我选择要上传的图像
【发布时间】:2019-07-18 08:19:14
【问题描述】:

我正在使用 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" />
  • 我的 config.xml 中是否缺少特定的允许意图? 我当前的设置如下:
  <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】:

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

    当我手动将第三方上传按钮 HTML 更改为 &lt;input type="file" /&gt; 时,它可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-19
      • 2017-10-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多