标签:des style blog http color io os ar 使用
URL dispatcher 是在Ubuntu OS上的一个服务。它可以让我们的应用(confined,i.e, click package应用)来启动其它的应用。这些应用通常是一个特别的URL来 识别的。可能最常见的例子就是向网页浏览器发送http:// URL来启动网页浏览器,但是像music或其它的应用也可以支持。对于大多数的应用来说,这是一个最有用的方式来退出现有的应用来启动另外一个应用。
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来启动其它的应用
标签:des style blog http color io os ar 使用
原文地址:http://blog.csdn.net/ubuntutouch/article/details/40407897