• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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 452 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.
    • S Offline
      s710
      last edited by 18 Jul 2021, 09:19

      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 18 Jul 2021, 12:08

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

        S 1 Reply Last reply 18 Jul 2021, 13:36 Reply Quote 0
        • S Offline
          s710 @kugiigi
          last edited by 18 Jul 2021, 13:36

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

          F 1 Reply Last reply 18 Jul 2021, 16:05 Reply Quote 0
          • F Offline
            flohack @s710
            last edited by 18 Jul 2021, 16:05

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

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

            S 1 Reply Last reply 18 Jul 2021, 16:08 Reply Quote 0
            • S Offline
              s710 @flohack
              last edited by 18 Jul 2021, 16:08

              @flohack How would I do this?

              F 1 Reply Last reply 18 Jul 2021, 16:11 Reply Quote 0
              • F Offline
                flohack @s710
                last edited by 18 Jul 2021, 16:11

                @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
                2 out of 6
                • First post
                  2/6
                  Last post