Registering url scheme for app
-
In order to implement OAuth workflows, I need my app to listen to callback URLs called by the browser after authentication. Since I didn't find anything covering ubuntu touch, I tried to follow this example:
[Desktop Entry] _Name=MyApp Exec=MyApp %U Icon=assets/logo.svg Terminal=false Type=Application X-Ubuntu-Touch=true MimeType=x-scheme-handler/myapp
QML:
[...] Label { id: label Layout.alignment: Qt.AlignHCenter text: i18n.tr('Press the button below and check the logs! ') + Qt.application.arguments[1] } [...]
Now after I installed the app on my Volla Phone, whenever I enter
myapp://something
in the browser, I will get a prompt asking whether or not I will allow to pass this to "some system app", however after accepting, nothing happens.I would expect that
MyApp
will be foregrounded and thesomething
-part is passed asQt.application.arguments[1]
.Does this even work on Ubuntu Touch? If so, what am I missing?
-
Check the url dispatcher section
https://docs.ubports.com/en/latest/appdev/guides/importing-CH-urldispatcher.html -
@kugiigi Thank you, that worked. Although the documentation seems to be outdated / pointing to files not matching the example, so I had to make some adjustments.
-
@s710 Please make PRs then to improve the documents, thanks!
-
@flohack How would I do this?
-
@s710 Well our documentation is hosted here: https://github.com/ubports/docs.ubports.com - you can either clone the repo to your local disk, or make online changes. Then, after submitting the changes, open a pull request and we will review and merge it if ok.