微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Android 的共享表上显示默认文件应用程序?

如何解决如何在 Android 的共享表上显示默认文件应用程序?

我正在开发一个笔记应用程序,我正在开发一个将其导出为 PDF 文档的功能

通过以下指南,我们实现了以 action.send 的形式发送到另一个应用程序的功能https://developer.android.com/guide/components/intents-filters

但是,Android 的认“文件”应用未显示在 android 共享表上。 我想实现通过 Android 的本机文件应用保存到设备的逻辑。

val intent = Intent()
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)

intent.action = Intent.ACTION_SEND
intent.type = "*/*"

val uri = FileProvider.getUriForFile(context,context.packageName + ".sharefileprovider",sharedFile)
intent.putExtra(Intent.EXTRA_STREAM,uri)
val intentChooser = Intent.createChooser(intent,"ShareTest")
context.startActivity(intentChooser)

I want the Files app to be displayed on the Share sheet like this image.

有什么解决办法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。