Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
198 views
in Technique[技术] by (71.8m points)

Flutter: Add shortcuts to launcher menu and home screen

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

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

1 Reply

0 votes
by (71.8m points)

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:[email protected]' 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...