0

Hi I'm sharing file using intent. And work well, share to whatsapp too.

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)
            }
        }
    }

But the problem if whatsapp with fingerprint on. Share file not work.

Any suggestion to share on this case?

Thank you

Eric Wijaya
  • 291
  • 3
  • 12

1 Answers1

0

Ah, I found the solution I should not include this code

target.flags = Intent.FLAG_ACTIVITY_NO_HISTORY

so remove this code, share will work on whatsapp with fingerprint on

Thanks for all the reply

Eric Wijaya
  • 291
  • 3
  • 12