UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Registering url scheme for app

    Scheduled Pinned Locked Moved App Development
    6 Posts 3 Posters 817 Views 2 Watching
    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.
    • s710S Offline
      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 Offline
        kugiigi
        last edited by

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

        s710S 1 Reply Last reply Reply Quote 0
        • s710S Offline
          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.

          flohackF 1 Reply Last reply Reply Quote 0
          • flohackF Offline
            flohack @s710
            last edited by

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

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

            s710S 1 Reply Last reply Reply Quote 0
            • s710S Offline
              s710 @flohack
              last edited by

              @flohack How would I do this?

              flohackF 1 Reply Last reply Reply Quote 0
              • flohackF Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better πŸ’—

                Register Login
                • First post
                  Last post