Navigation

    UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Registering url scheme for app

    App Development
    3
    6
    281
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • s710
      s710 last edited by

      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 the something-part is passed as Qt.application.arguments[1].

      Does this even work on Ubuntu Touch? If so, what am I missing?

      1 Reply Last reply Reply Quote 0
      • K
        kugiigi last edited by

        Check the url dispatcher section
        https://docs.ubports.com/en/latest/appdev/guides/importing-CH-urldispatcher.html

        s710 1 Reply Last reply Reply Quote 0
        • s710
          s710 @kugiigi last edited by

          @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.

          Flohack 1 Reply Last reply Reply Quote 0
          • Flohack
            Flohack @s710 last edited by

            @s710 Please make PRs then to improve the documents, thanks!

            My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

            s710 1 Reply Last reply Reply Quote 0
            • s710
              s710 @Flohack last edited by

              @flohack How would I do this?

              Flohack 1 Reply Last reply Reply Quote 0
              • Flohack
                Flohack @s710 last edited by

                @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.

                My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post