Use the URL dispatcher on the Ubuntu OS to launch other apps

Source: Internet
Author: User

URL Dispatcher is a service on Ubuntu OS. It allows our application (CONFINED,I.E, click Package app) to launch other applications. These applications are usually identified by a special URL. Perhaps the most common example is sending to a Web browser / http URLTo launch a Web browser, but like music or other apps can support it. For most applications, this is one of the most useful ways to quit an existing app to launch another application.


For QT applications, the way it accesses URL dispatcher is through QT's desktop plugin. C + + apps can be used by using the Qdesktopservices.openurl () method. QML applications can make
Use the qt.openurlexternally (string) method. For other applications, they can use the Platform API or use the Liburl-dispatcher directly, depending on their needs.

The URL dispatcher item can be found in the Launchpad link. Supported URL formats

Basic URL format
There are several supported formats in the URL dispatcher:



application:///$ (app_id). Desktop
The application URL can be used to start an application with a known application ID. For applications this install their desktop file in/usr/share/applications the application ID should just be the name of The desktop file.
appid://$ (pkg)/$ (APP)/$ (version) Allows for launching a application using an application ID. Also provides for wild cards. The $ (app) can is first-listed, last-listed-app or only-listed-app to select the appropriate AP Plicaiton using the click Manifest. Also the $ (version) can current-user-version to select the version in the manifest

The second method here is the recommended method. For example, for clock applications, we can see the following app URLs:


Appid://com.ubuntu.clock/clock/current-user-version

We can use the following method to get information about the click Package in the Phone:




App URL

For some applications, we can launch the app with some parameters at the same time when the app is launched. We can register the app by adding the URL's definition to the app's click Manifest file to be launched by one or more URLs. To achieve this, we can add a statement to the "Hooks" section of the file that has a small JSON file that is tied to "desktop". A simple manifest is defined as follows.


{"        name": "My App",        "version": "1.2.3", "        hooks": {                "foo": {                        "desktop": "Foo.desktop",                        "URLs" : "Foo.url-dispatcher"}}        }

Here it points to another JSON file in the click Package. It defines what URLs will be accepted. A simple file is like the following format:

[        {                "protocol": "foo",                "Domain-suffix": "Bar.com"        }]

By the definition above, whenever there is a URL request like "foo://*.bar.com" format, the application represented by Foo.desktop will be automatically called. Here, if the "Domain-suffix" entry is omitted, the application will accept all requests in the protocol format represented by "Foo". The definition of URL dispatcher is an array so that many of these formats can be defined in the application.

A routine shows how to call music and clock can be found at the following address:

BZR Branch Lp:~liu-xiao-guo/debiantrial/launchapps

Use the URL dispatcher on the Ubuntu OS to launch other apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.