Since: 2.4
Interface | Method |
---|---|
PackageManagerObject | |
PackageManager |
void install (DOMString packageFileURI, PackageProgressCallback progressCallback, optional ErrorCallback? errorCallback)
void uninstall (PackageId id, PackageProgressCallback progressCallback, optional ErrorCallback? errorCallback)
void getPackagesInfo (PackageInformationArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
void setPackageInfoEventListener (PackageInformationEventCallback eventCallback)
void unsetPackageInfoEventListener () |
PackageInformation | |
PackageInformationArraySuccessCallback |
void onsuccess (PackageInformation[] informationArray) |
PackageProgressCallback |
void onprogress (PackageId id, short progress)
void oncomplete (PackageId id) |
PackageInformationEventCallback |
void oninstalled (PackageInformation info)
void onupdated (PackageInformation info)
void onuninstalled (PackageId id) |
[NoInterfaceObject] interface PackageManagerObject {
readonly attribute PackageManager package;
};
Tizen implements PackageManagerObject;
Since: 2.4
The tizen.package object allows access to Package API functionality.
[NoInterfaceObject] interface PackageManager {
void install(DOMString packageFileURI,
PackageProgressCallback progressCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void uninstall(PackageId id,
PackageProgressCallback progressCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void getPackagesInfo(PackageInformationArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
PackageInformation getPackageInfo(optional PackageId? id) raises(WebAPIException);
void setPackageInfoEventListener(PackageInformationEventCallback eventCallback) raises(WebAPIException);
void unsetPackageInfoEventListener() raises(WebAPIException);
};
Since: 2.4
install
void install(DOMString packageFileURI, PackageProgressCallback progressCallback, optional ErrorCallback? errorCallback);
Since: 2.4
This API provides a way to notify the progress and completion of an installation request through PackageProgressCallback.
The ErrorCallback() is launched with these error types:
Privilege level: platform
Privilege: http://tizen.org/privilege/packagemanager.install
Remark : Virtual path cannot be used for the parameter. First, you need to convert any virtual path to a file URI path using the resolve function in the Filesystem API before passing it to the function.
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
var onInstallation = {
onprogress: function(packageId, percentage) {
console.log("On installation(" + packageId + ") : progress(" + percentage + ")");
},
oncomplete: function(packageId) {
console.log("Installation(" + packageId + ") Complete");
}
}
var onError = function (err) {
console.log("Error occurred on installation : " + err.name);
}
// Let's assume that the "test.wgt" file exists in the downloads directory
tizen.filesystem.resolve("downloads/test.wgt",
function (file) {
console.log("file URI : " + file.toURI());
tizen.package.install(file.toURI(), onInstallation, onError);
},
function (err) {
console.log("Error occurred on resolve : " + err.name);
},
"r");
uninstall
void uninstall(PackageId id, PackageProgressCallback progressCallback, optional ErrorCallback? errorCallback);
Since: 2.4
This API provides a way to notify about the progress and completion of an uninstallation request through PackageProgressCallback.
The ErrorCallback() is launched with these error types:
Privilege level: platform
Privilege: http://tizen.org/privilege/packagemanager.install
Remark : Some preloaded packages cannot be uninstalled. In this case, ErrorCallback with the UnKnownError type is launched.
Parameters:
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
var onUninstallation = {
onprogress: function(packageId, percentage) {
console.log("On Uninstallation(" + packageId + ") : progress(" + percentage + ")");
},
oncomplete: function(packageId) {
console.log("Uninstallation(" + packageId + ") Complete");
}
};
var onError = function (err) {
console.log("Error occurred on installation : " + err.name);
};
// Let's assume that the package ID to uninstall is "testapp001"
tizen.package.uninstall("testapp001", onUninstallation, onError);
getPackagesInfo
void getPackagesInfo(PackageInformationArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
The result contains the snapshots of the installed packages information.
The errorCallback() is launched with this error type:
Privilege level: public
Privilege: http://tizen.org/privilege/package.info
Parameters:
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
function onListInstalledPackages(packages) {
for (var i = 0; i < packages.length; i++) {
console.log("Package id["+i+"] : " +packages[i].id);
}
}
tizen.package.getPackagesInfo(
onListInstalledPackages,
function (err) {console.log("Can't obtain packages list" + err.name);});
getPackageInfo
PackageInformation getPackageInfo(optional PackageId? id);
Since: 2.4
If the ID is set to null or not set at all, it returns the package information of the current application. The list of installed packages and their package IDs is obtained using getPackagesInfo().
Privilege level: public
Privilege: http://tizen.org/privilege/package.info
Parameters:
Return value:
PackageInformation The information of a packageExceptions:
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotFoundError, if the package with the specified ID is not found.
with error type UnknownError, if the package information cannot be retrieved because of a platform error.
Code example:
var packageInfo = tizen.package.getPackageInfo(null);
console.log("Current Package ID : " + packageInfo.id);
setPackageInfoEventListener
void setPackageInfoEventListener(PackageInformationEventCallback eventCallback);
Since: 2.4
This method sets a PackageInformationEventCallback type callback that is triggered when a package is installed, removed, or updated.
The callback lasts until the unsetPackageInfoEventListener() method is called.
Privilege level: public
Privilege: http://tizen.org/privilege/package.info
Parameters:
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if the package list change event cannot be generated because of a platform error.
Code example:
var packageEventCallback = {
oninstalled: function(packageInfo) {
console.log('The package ' + packageInfo.name + ' is installed');
},
onupdated: function(packageInfo) {
console.log('The package ' + packageInfo.name + ' is updated');
},
onuninstalled: function(packageId) {
console.log('The package ' + packageId + ' is uninstalled');
}
};
tizen.package.setPackageInfoEventListener(packageEventCallback);
unsetPackageInfoEventListener
void unsetPackageInfoEventListener();
Since: 2.4
Privilege level: public
Privilege: http://tizen.org/privilege/package.info
Exceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if the listener removal request fails because of a platform error.
Code example:
tizen.package.unsetPackageInfoEventListener();
[NoInterfaceObject] interface PackageInformation {
readonly attribute PackageId id;
readonly attribute DOMString name;
readonly attribute DOMString iconPath;
readonly attribute DOMString version;
readonly attribute long totalSize;
readonly attribute long dataSize;
readonly attribute Date lastModified;
readonly attribute DOMString author;
readonly attribute DOMString description;
readonly attribute ApplicationId[] appIds;
};
Since: 2.4
Since: 2.4
Since: 2.4
The icon path of the package is the same as the icon path of the relevant application (see the iconPath attribute of the ApplicationInformation interface).
The relevant application is the one with the same packageId as the id of this package.
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
[Callback=FunctionOnly, NoInterfaceObject] interface PackageInformationArraySuccessCallback {
void onsuccess(PackageInformation[] informationArray);
};
Since: 2.4
It is used in tizen.package.getPackagesInfo().
onsuccess
void onsuccess(PackageInformation[] informationArray);
Since: 2.4
Parameters:
[Callback, NoInterfaceObject] interface PackageProgressCallback {
void onprogress(PackageId id, short progress);
void oncomplete(PackageId id);
};
Since: 2.4
onprogress
void onprogress(PackageId id, short progress);
Since: 2.4
Parameters:
oncomplete
void oncomplete(PackageId id);
Since: 2.4
Parameters:
[Callback, NoInterfaceObject] interface PackageInformationEventCallback {
void oninstalled(PackageInformation info);
void onupdated(PackageInformation info);
void onuninstalled(PackageId id);
};
Since: 2.4
oninstalled
void oninstalled(PackageInformation info);
Since: 2.4
Parameters:
onupdated
void onupdated(PackageInformation info);
Since: 2.4
Parameters:
onuninstalled
void onuninstalled(PackageId id);
Since: 2.4
Parameters:
module Package {
typedef DOMString PackageId;
[NoInterfaceObject] interface PackageManagerObject {
readonly attribute PackageManager package;
};
Tizen implements PackageManagerObject;
[NoInterfaceObject] interface PackageManager {
void install(DOMString packageFileURI,
PackageProgressCallback progressCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void uninstall(PackageId id,
PackageProgressCallback progressCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void getPackagesInfo(PackageInformationArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
PackageInformation getPackageInfo(optional PackageId? id) raises(WebAPIException);
void setPackageInfoEventListener(PackageInformationEventCallback eventCallback) raises(WebAPIException);
void unsetPackageInfoEventListener() raises(WebAPIException);
};
[NoInterfaceObject] interface PackageInformation {
readonly attribute PackageId id;
readonly attribute DOMString name;
readonly attribute DOMString iconPath;
readonly attribute DOMString version;
readonly attribute long totalSize;
readonly attribute long dataSize;
readonly attribute Date lastModified;
readonly attribute DOMString author;
readonly attribute DOMString description;
readonly attribute ApplicationId[] appIds;
};
[Callback=FunctionOnly, NoInterfaceObject] interface PackageInformationArraySuccessCallback {
void onsuccess(PackageInformation[] informationArray);
};
[Callback, NoInterfaceObject] interface PackageProgressCallback {
void onprogress(PackageId id, short progress);
void oncomplete(PackageId id);
};
[Callback, NoInterfaceObject] interface PackageInformationEventCallback {
void oninstalled(PackageInformation info);
void onupdated(PackageInformation info);
void onuninstalled(PackageId id);
};
};