Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
191 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...