Android 7.1 static app-shortcuts creator 可以在 intent 中添加额外内容吗?

Can Android 7.1 static app-shortcuts creator put extras into the intent?

这是一个简短的问题:

Android Nougat 7.1 为启动器提供了一项新功能,即通过显示菜单来创建应用程序快捷方式以供选择: https://developer.android.com/about/versions/nougat/android-7.1.html https://developer.android.com/guide/topics/ui/shortcuts.html

据我所知,如果您使用动态快捷方式,则可以将任何您想要的内容放入其中,但是静态快捷方式(那​​些通过 XML 预先确定的快捷方式)可以有额外的内容吗? 含义:例如,我可以在快捷方式的意图包中放置一个字符串吗?还是我只能选择他们每个人的动作?

我问这个是因为我没有看到那里提到它。

是的,根据 R.styleable#Intent:

Declaration of an Intent object in XML. May also include zero or more <categories> and <extra> tags.

解析Intent可见Intent.parseIntent source code, where you'll see it parses the extra tags with Resources.parseBundleExtra(),支持Strings, booleans, integers, floats

<intent android:action="YOUR_ACTION" >
     <extra android:name="extra_name" android:value="extra_value" />
</intent>