-1

I checked this question with similar title: How can I place app icon on launcher home screen?

But in this question questioner wants to add app shortcut automatically during installation, which is not my problem. I am trying to build a basic web browser using flutter. I want to add website shortcuts in home screen and also in launcher menu (where all installed apps are listed). Is there any way I can do that?

mig001
  • 179
  • 1
  • 18

1 Answers1

0

You can use Dynamic Linking (https://pub.dev/packages/firebase_dynamic_links).

This way, you can use a generated link to get parameters like what URL to open, if its fullscreen, if it's a new tab or window, and so on. It works the same way as 'mailto:asd@asd.com' to send emails. You can set your dynamic links as 'yourappname/openUrl=http://google.com'. Then, in your Flutter app, you will detect that dynamic linking that matches with your app id, and you will be able to get the parameters and take actions according to that.

Take a look at the next example of this Firebase Dynamic Links library:

final ShortDynamicLink shortenedLink = await DynamicLinkParameters.shortenUrl(
  Uri.parse('https://example.page.link/?link=https://example.com/&apn=com.example.android&ibn=com.example.ios'),
  DynamicLinkParametersOptions(ShortDynamicLinkPathLength.unguessable),
);

This way, you can parse multiple queries and achieve your goal.

J Manuel
  • 3,010
  • 22
  • 39