This is a short question:
Android Nougat 7.1 has a new feature for launchers, to create app-shortcuts by showing a menu to choose from them: https://developer.android.com/about/versions/nougat/android-7.1.html https://developer.android.com/guide/topics/ui/shortcuts.html
From what I see, if you use dynamic ones, you can put anything you wish into them, but can static shortcuts (those that are pre-determined via XML) have extras in them? Meaning: can I put, for example, a string in the bundle of the intent of shortcuts ? Or can I only choose which action each of them will have?
I ask this because I don't see it mentioned there.
Yes, as per R.styleable#Intent:
Declaration of an Intent object in XML. May also include zero or more
<categories>
and<extra>
tags.
Parsing the Intent can be seen in the Intent.parseIntent source code, where you'll see it parses the extra
tags with Resources.parseBundleExtra(), which supports Strings, booleans, integers, and floats.
<intent android:action="YOUR_ACTION" >
<extra android:name="extra_name" android:value="extra_value" />
</intent>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With