Issue
Hello!
I want to add an Android launcher shortcut to open a link with it. Something like this images This is possible? And if is possible, how can I make it?
Solution
An example of creating a dynamic shortcut and associating it with your app appears in the following code snippet:
ShortcutInfo shortcut = new ShortcutInfoCompat.Builder(context, "id1")
.setShortLabel("Website")
.setLongLabel("Open the website")
.setIcon(Icon.createWithResource(context, R.drawable.icon_website))
.setIntent(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.mysite.example.com/")))
.build();
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut);
Answered By - javdromero
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.