【问题标题】:Share file via intent android to whatsapp with fingerprint on not work通过intent android将文件共享到whatsapp,指纹不起作用
【发布时间】:2020-05-30 01:49:00
【问题描述】:

您好,我正在使用 Intent 共享文件。 效果不错,也分享到whatsapp。

fun shareFile(fileList: List<File>) {
        activity?.let {
            val target = Intent(Intent.ACTION_SEND_MULTIPLE)
            val uriList = fileList.map { file ->
                FileProvider.getUriForFile(
                        it.baseContext, it.applicationContext?.packageName + ".provider", file)
            }

            target.putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(uriList))
            target.type = "application/pdf"
            target.flags = Intent.FLAG_ACTIVITY_NO_HISTORY
            target.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)

            try {
                startActivity(Intent.createChooser(target, ""))
            } catch (e: ActivityNotFoundException) {
                Crashlytics.logException(e)
            }
        }
    }

但是如果whatsapp 开启了指纹就会出现问题。 共享文件无效。

有什么建议可以分享一下这个案例吗?

谢谢

【问题讨论】:

  • 请把你的代码放在这里。我们不知道你做了什么
  • 查看我的解决方案,我的第二个 sn-p 代码可以帮助您将图像分享到社交媒体

标签: android share whatsapp fingerprint


【解决方案1】:

啊,我找到了解决方案 我不应该包含此代码

target.flags = Intent.FLAG_ACTIVITY_NO_HISTORY

所以删除此代码,共享将在带有指纹的whatsapp上工作

感谢大家的回复

【讨论】:

    猜你喜欢
    • 2021-10-28
    • 2016-01-18
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-19
    • 1970-01-01
    相关资源
    最近更新 更多