与其他应用共享资产时如何更改标题元数据

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

我正在使用以下代码通过Intent将文本+链接发送到其他应用。

fun onShareButtonClicked(context: Context) {
    val shareMessage = "This is a message"
    val sendIntent: Intent = Intent().apply {
        action = Intent.ACTION_SEND
        putExtra(Intent.EXTRA_TEXT, "$shareMessage \n\n[url]")
        type = "text/plain"
    }

    val shareSheetTitle = SpannableStringBuilder()
        .bold { append(shareContent) }
        .append("\n[url]")

    val shareIntent = Intent.createChooser(sendIntent, shareSheetTitle)
    context.startActivity(shareIntent)
}

上面的代码显示了共享数据,与此类似。但是,我想更改元数据标题(在图像中突出显示)。如何在Android中执行此操作?

enter image description here

android android-intent metadata meta-tags
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.