Using Deep Links to open a snap

Hello all,

I am developing a flutter app and I am publishing it to the Snapstore. For my next release I want to add deep links:

Deep links are a type of link that send users directly to an app instead of a website or a store . They are used to send users straight to specific in-app locations, saving users the time and energy locating a particular page themselves – significantly improving the user experience. source

I am using this package and here it was mentioned that it is up to the installer to configure the deep link. Now I am curious if this is possible at all with snaps and if so, how is it possible?

Thank you very much for your time.

You need to modify the .desktop file that snapd uses to generate the desktop entry. Primarily you need:

  1. A line registering the protocol. e.g:
MimeType=x-scheme-handler/my-protocol-name;
  1. Modify the exec= line to establish what arguments are acceptable, with valid argument types here.

So for example

[Desktop Entry]
Name=CarrollNotes
Comment=A meme notetaking application
Exec=CarrollNotes %u
Icon=${SNAP}/meta/gui/CarrollNotes.svg
Type=Application
Categories=Office;
MimeType=x-scheme-handler/CarrollNotes;

If this is done correctly, other applications will be able to call your protocol handler, and the arguments would be passed to your snap to handle. You could then hypothetically launch CarrollNotes://OpenNote?=foobar and the snap would be passed the argument and be free to respond to it.

@James-Carroll how can I test a link like that?

I setup my .desktop like this

[Desktop Entry]
version=1.5
Name=DaKanji
Comment=You are learning Japanese? Then you need to try DaKanji!
Exec=dakanji %u
Icon=${SNAP}/bin/data/flutter_assets/assets/images/dakanji/icon.png
Terminal=false
Type=Application
Categories=Education;Languages;
MimeType=x-scheme-handler/dakanji;

After installing the snap and typing DaKanji://OpenNote into Firefox’s search bar nothing happens.