Android launcher - browser link redirect shortcut

247 Views Asked by At

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?

enter images description here

1

There are 1 best solutions below

0
On BEST ANSWER

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);

Reference