application:///$(app_id).desktop |
The application URL can be used to start an application with a known Application ID. For applications that 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 an application using an application ID. Also provides for wild cards. The $(app) can be first-listed, last-listed-app or only-listed-app to select the appropriate applicaiton using the click manifest. Also the $(version) can be current-user-version to select the version in the manifest |
这里的第二种方法是推荐的方法。比如对于Clock应用来说,我们可以看到如下的应用URL:
appid://com.ubuntu.clock/clock/current-user-version
我们可以通过如下的方法得到在手机中应用click package的信息:
对于一些应用来说,我们可以在启动应用的时候同时传人一些参数来启动该应用。我们可以通过在应用的Click manifest文件中加入URL的定义来注册该应用可以被一个或多个URL来启动。为了达到这个目的,我们可以在该文件中的“hooks”部分加入一个和“desktop”并列的小的json文件的申明。一个简单的manifest就像下面定义的。
{ "name": "My App", "version": "1.2.3", "hooks": { "foo": { "desktop": "foo.desktop", "urls": "foo.url-dispatcher" } } }
[ { "protocol": "foo", "domain-suffix": "bar.com" } ]
一个例程显示如何调用Music及Clock可以在如下的地址找到:
bzr branch lp:~liu-xiao-guo/debiantrial/launchapps
使用Ubuntu OS上的URL dispatcher来启动其它的应用
原文:http://blog.csdn.net/ubuntutouch/article/details/40407897