© 2009-2010 OMTP Ltd. All rights reserved. OMTP and OMTP BONDI are registered trademarks of OMTP Ltd.
To launch applications from the Web context
AppLauncherSuccessCallback
AppLauncherManager
AppLauncherManagerObject
| Interface | Method |
|---|---|
| AppLauncherSuccessCallback | void onSuccess(StringArray obj) |
| AppLauncherManager | PendingOperation launchApplication(SuccessCallback successCallback, ErrorCallback errorCallback, DOMString appURI, StringArray params) PendingOperation getInstalledApplications(AppLauncherSuccessCallback successCallback, ErrorCallback errorCallback) DOMString getDefaultApplication(DOMString mimeType) |
| AppLauncherManagerObject |
Copyright 2010 OMTP Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The BONDI applauncher interface provides access to the installed applications.
It also provides access to the native applications such as messaging, telephony and newly installed
applications.
This API creates (or represents) a link between the standard URI prefix and native applications, following is a list of the minimum
supported protocols and their native applications:
- http,https: default browser installed in the device.
- tel: default telephony application
- sms: default sms composing application
- mailto: default email composing application
-file: access to any file stored in the device through its fully qualified path. The file will be opened with its default application.
Also an executable would be pointed using this protocol. If a executable is pointed the application
will be launched with the possibility to pass parameter to this application.
You can launch applications using the applauncher.launchApplication method.
This API provides functionality to run the installed applications in the device. The application listed using this option are those that have been registered in the system. Not all the executables are listed using this functionality. You can get the installed applications using the applauncher.getInstalledApplications method.
This API provides functionality to get the default application for a given MIME type. The MIME types supported are those that the device has applications to manage them. You can get the default applications for a given MIME type using the applauncher.getDefaultApplication method.
This is the URI used to declare this API's feature set, for use in bondi.requestFeature. For the URL, the list of features included by the feature set is provided.
All the AppLauncher features
Includes API features:
http://bondi.omtp.org/api/1.1/applauncher.launch
http://bondi.omtp.org/api/1.1/applauncher.get
This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions covered is provided.
When any of the features
http://bondi.omtp.org/api/1.1/applauncher.get
http://bondi.omtp.org/api/1.1/applauncher.launch
is successfully requested, the interface
AppLauncherManager
is instantiated, and the resulting object appears in the global
namespace as
Bondi.applauncher.
Call to AppLauncherManager methods launchApplication
Device capabilities:
applauncher.launch
Call to AppLauncherManager methods for getting list of applications
Device capabilities:
applauncher.get
applauncher.launch
Launches an application stored in the phone terminal
Security parameters:
knownname:
Known name of application, from the list given after this
table. Empty bag if application being launched does not have a well Known
name. The Known application name is determined by the implementation
from the information provided in the API.
appparam:
Parameter to application; meaning dependent on knownname.
path:
allows limiting filesystem location from which applications can be launched
applauncher.get
Gets the list of installed applications or the default one for a given mime type
AppLauncherSuccessCallback
Success callback for retrieving a list of applications
[Callback=FunctionOnly, NoInterfaceObject] interface AppLauncherSuccessCallback {
void onSuccess(in StringArray obj);
};
Success callback that is used in the asynchronous operation to retrieve a list of applications.
onSuccess
The callback that is invoked when retrieving the list of applications or the handler for a given mime type complete successfully.
void onSuccess(in StringArray obj);
AppLauncherManager
Application management base interface
interface AppLauncherManager {
PendingOperation launchApplication(in SuccessCallback successCallback,
in ErrorCallback errorCallback,
in DOMString appURI,
[Optional] in StringArray params);
PendingOperation getInstalledApplications(in AppLauncherSuccessCallback successCallback,
in ErrorCallback errorCallback);
DOMString getDefaultApplication(in DOMString mimeType)
raises(DeviceAPIError);
};
The application manager interface offers methods concerned with retrieving and launching applications.
launchApplication
Launches an application addressed by an URI string.
PendingOperation launchApplication(in SuccessCallback successCallback, in ErrorCallback errorCallback, in DOMString appURI, in StringArray params);
Asynchronous method.
The following URIs are the minimal set that are supported
- http://
- https://
- tel:
- mailto:
- sms:
- file://
If the method is executed successfully the successcallback is raised If the access is denied by the Security Policy, the ErrorCallback will be invoked with a SecurityError PERMISSION_DENIED_ERROR If an invalid parameter is passed such as malformed URIs (protocol not supported or invalid URI parameters), the ErrorCallback will be invoked with an DeviceAPIError INVALID_ARGUMENT_ERROR If the application is not found, the ErrorCallback is invoked with a DeviceAPIError NOT_FOUND_ERROR
// Define the success callback.
function successCallback(response) {
alert("Application launches successful");
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.code + ", occurred launching an application");
}
// launch the phone application
bondi.applauncher.launchApplication(successCallback,errorCallback,"tel:+34666666666");
// launch the browser with the http address passed as parameter
bondi.applauncher.launchApplication(successCallback,errorCallback,"http://www.huescalamagia.es");
getInstalledApplications
Returns an array of strings containing the installed applications on the device. (applications that have somehow been registered in the platform). The returned strings are fully qualified application paths
PendingOperation getInstalledApplications(in AppLauncherSuccessCallback successCallback, in ErrorCallback errorCallback);
Asynchronous method.
If the method is executed successfully the successCallback is raised. If no applications are installed in the device an empty array will be returned to the successCallback If the access is denied by the Security Policy, the ErrorCallback will be invoked with a SecurityError PERMISSION_DENIED_ERROR If an invalid parameter is passed the ErrorCallback will be invoked with an DeviceAPIError INVALID_ARGUMENT_ERROR
// Define the launchApplication success callback.
function launchedCallback(response)
{
alert("Application launched successful");
}
// Define the getInstalledApplications success callback.
function successCallback(response) {
// Response is an array of fully qualified application paths - let's launch the first application.
bondi.applauncher.launchApplication(launchedCallback,errorCallback,"file://"+ response[0]);
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.code + ", occurred");
}
// Get the installed applications.
bondi.applauncher.getInstalledApplications(successCallback,errorCallback,null);
getDefaultApplication
Returns the application path for the default handler for a given mime type.
DOMString getDefaultApplication(in DOMString mimeType);
Returns null if no default application is found for the given MIME Type
INVALID_ARGUMENT_ERROR if an invalid MIME type is given. The supported MIME types are the same as the terminal has registered.
// Define the success callback.
function successCallback(response) {
alert("Application launches successful");
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.code + ", occurred launching an application");
}
// Get the default application for the text/plain mime type.
var app = bondi.applauncher.getDefaultApplication("text/plain");
// Launch the application.
bondi.applauncher.launchApplication(successCallback, errorCallback, "file://" + app, "/text.txt");
AppLauncherManagerObject
Specifies what is instantiated at feature request
interface AppLauncherManagerObject {
readonly attribute AppLauncherManager applauncher;
};
Bondi implements AppLauncherManagerObject;