I just made the fix to the original code even easier, and now it will properly launch the ShortcutActivity in the sample project!
Simply add this to the Manifest (no changes needed to the main activity in the sample):
AddApplicationText(<activity android:windowSoftInputMode="stateHidden" android:launchMode="singleTop" android:name="shortcutactivity"
android:label="Add Shortcut" android:screenOrientation="unspecified">
</activity>"
)
AddActivityText(ShortcutActivity,
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>)
A user (nerdworld) added the second section (AddActivityText), but I had to change the first phrase from "Shortcut" to "ShortcutActivity" and then this entry allows the "ShortcutActivity" to be launched properly.
I tested this on 5.0.1 and 7.1.1.
UPDATE 4/27/19: I found out the Intent-filter declaration is not needed in the first "AddApplicationText" and is just needed in the second "AddActivityText" only. So, I removed it.
NOTE: What is cool about this method is that when the user goes to place the icon on their homepage, you can add UI code to the ShortcutActivity that will prompt the user to specify options for the icon before it is even created!
For example lets say the user wants to create an icon that jumps right to your apps settings activity. When the user selects this special option, you can then can stuff special configuration data into the icon like this:
shortcutIntent.PutExtra("StartSettings", True)
Then when your app launches, you can check in the Main activity's Activity_Resume sub to see what options the icon was configured for and do those special actions only when your app is launched by that particular shortcut:
If in.HasExtra("StartSettings") And in.GetExtra("StartSettings") = True Then
StartActivity(Settings)
End if