未验证 提交 0ffe99c3 编写于 作者: O openharmony_ci 提交者: Gitee

!19693 【EDM】修改示例代码

Merge pull request !19693 from 李兀立/master
......@@ -75,7 +75,7 @@ onBundleAdded(bundleName: string): void
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("added bundle name: " + bundleName);
console.info(`Succeeded in calling onBundleAdded callback, added bundle name : ${bundleName}`);
}
};
```
......@@ -100,8 +100,8 @@ onBundleRemoved(bundleName: string): void
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("removed bundle name: " + bundleName);
onBundleRemoved(bundleName: string) {
console.info(`Succeeded in calling onBundleRemoved callback, removed bundle name : ${bundleName}`);
}
};
```
......@@ -127,7 +127,7 @@ onAppStart(bundleName: string): void
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onAppStart(bundleName: string) {
console.log("started bundle name: " + bundleName);
console.info(`Succeeded in calling onAppStart callback, started bundle name : ${bundleName}`);
}
};
```
......@@ -153,7 +153,7 @@ onAppStop(bundleName: string): void
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onAppStop(bundleName: string) {
console.log("stopped bundle name: " + bundleName);
console.info(`Succeeded in calling onAppStop callback, stopped bundle name : ${bundleName}`);
}
};
```
......@@ -46,13 +46,16 @@ disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback&
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
accountManager.disallowAddLocalAccount(wantTemp, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
accountManager.disallowAddLocalAccount(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to disallow add local account. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disallowing add local account');
});
```
......@@ -94,12 +97,13 @@ disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void>
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
accountManager.disallowAddLocalAccount(wantTemp, true).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in disallowing add local account');
}).catch((err) => {
console.error(`Failed to disallow add local account. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -47,19 +47,20 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_SUPER, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("enableAdmin success");
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_SUPER, (err) => {
if (err) {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in enabling admin');
});
```
......@@ -99,19 +100,20 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("enableAdmin success");
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100, (err) => {
if (err) {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in enabling admin');
});
```
......@@ -156,16 +158,16 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100)
.catch(error => {
console.log("error occurs" + error);
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100).catch((err) => {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -200,15 +202,16 @@ disableAdmin(admin: Want, callback: AsyncCallback\<void>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableAdmin success ");
adminManager.disableAdmin(wantTemp, (err) => {
if (err) {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling admin');
});
```
......@@ -244,15 +247,16 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, 100, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableAdmin success ");
adminManager.disableAdmin(wantTemp, 100, (err) => {
if (err) {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling admin');
});
```
......@@ -293,11 +297,12 @@ disableAdmin(admin: Want, userId?: number): Promise\<void>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, 100).catch(error => {
console.log("error occurs" + error);
adminManager.disableAdmin(wantTemp, 100).catch((err) => {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -331,13 +336,14 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void
**示例**
```js
let bundleName = "com.example.myapplication";
adminManager.disableSuperAdmin(bundleName, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableSuperAdmin success");
let bundleName = 'com.example.myapplication';
adminManager.disableSuperAdmin(bundleName, (err) => {
if (err) {
console.error(`Failed to disable super admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling super admin');
});
```
......@@ -376,9 +382,10 @@ disableSuperAdmin(bundleName: String): Promise\<void>
**示例**
```js
let bundleName = "com.example.myapplication";
adminManager.disableSuperAdmin(bundleName).catch(error => {
console.log("error occurs" + error);
let bundleName = 'com.example.myapplication';
adminManager.disableSuperAdmin(bundleName).catch((err) => {
console.error(`Failed to disable super admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -403,15 +410,16 @@ isAdminEnabled(admin: Want, callback: AsyncCallback\<boolean>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
adminManager.isAdminEnabled(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query admin is enabled or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
});
```
......@@ -437,15 +445,16 @@ isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\<boolean>):
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, 100, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
adminManager.isAdminEnabled(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to query admin is enabled. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
});
```
......@@ -476,13 +485,14 @@ isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, 100).then((result) => {
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query admin is enabled or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -506,13 +516,14 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
**示例**
```js
let bundleName = "com.example.myapplication";
adminManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
let bundleName = 'com.example.myapplication';
adminManager.isSuperAdmin(bundleName, (err, result) => {
if (err) {
console.error(`Failed to query admin is super admin or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is super admin or not, result : ${result}`);
});
```
......@@ -541,11 +552,12 @@ isSuperAdmin(bundleName: String): Promise\<boolean>
**示例**
```js
let bundleName = "com.example.myapplication";
let bundleName = 'com.example.myapplication';
adminManager.isSuperAdmin(bundleName).then((result) => {
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in querying admin is super admin or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query admin is super admin or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -581,19 +593,20 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("setEnterpriseInfo success");
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo, (err) => {
if (err) {
console.error(`Failed to set enterprise info. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in setting enterprise info');
});
```
......@@ -634,15 +647,16 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\<void>;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo).catch(error => {
console.log("error occurs" + error);
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo).catch((err) => {
console.error(`Failed to set enterprise info. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -675,16 +689,16 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback&lt;EnterpriseInfo&gt;): v
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
adminManager.getEnterpriseInfo(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result.name);
console.log(result.description);
adminManager.getEnterpriseInfo(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get enterprise info. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting enterprise info, enterprise name : ${result.name}, enterprise description : ${result.description}`);
});
```
......@@ -722,14 +736,14 @@ getEnterpriseInfo(admin: Want): Promise&lt;EnterpriseInfo&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
adminManager.getEnterpriseInfo(wantTemp).then((result) => {
console.log(result.name);
console.log(result.description);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in getting enterprise info, enterprise name : ${result.name}, enterprise description : ${result.description}`);
}).catch((err) => {
console.error(`Failed to get enterprise info. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -766,14 +780,17 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.subscribeManagedEvent(wantTemp, events, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
adminManager.subscribeManagedEvent(wantTemp, events, (err) => {
if (err) {
console.error(`Failed to subscribe managed event. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in subscribe managed event');
});
```
......@@ -815,13 +832,14 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.subscribeManagedEvent(wantTemp, events).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to subscribe managed event. Code: ${err.code}, message: ${err.message}`);
})
```
......@@ -858,14 +876,17 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callba
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.unsubscribeManagedEvent(wantTemp, events, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
adminManager.unsubscribeManagedEvent(wantTemp, events, (err) => {
if (err) {
console.error(`Failed to unsubscribe managed event. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in unsubscribe managed event');
});
```
......@@ -907,13 +928,14 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promi
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to unsubscribe managed event. Code: ${err.code}, message: ${err.message}`);
})
```
......
......@@ -47,15 +47,17 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: Async
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed running bundles');
});
```
......@@ -93,15 +95,17 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number,
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed running bundles');
});
```
......@@ -144,15 +148,15 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in adding disallowed running bundles');
}).catch((err) => {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -189,15 +193,17 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: As
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed running bundles');
});
```
......@@ -235,15 +241,17 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: numb
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed running bundles');
});
```
......@@ -286,15 +294,15 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: num
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in removing disallowed running bundles');
}).catch((err) => {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -330,14 +338,16 @@ getDisallowedRunningBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;str
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
applicationManager.getDisallowedRunningBundles(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -374,14 +384,16 @@ getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
applicationManager.getDisallowedRunningBundles(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -423,12 +435,13 @@ getDisallowedRunningBundles(admin: Want, userId?: number): Promise&lt;Array&lt;s
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
applicationManager.getDisallowedRunningBundles(wantTemp, 100).then((result) => {
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -46,15 +46,17 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCal
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to add allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding allowed install bundles');
});
```
......@@ -92,15 +94,17 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, ca
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to add allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding allowed install bundles');
});
```
......@@ -143,15 +147,15 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number):
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in adding allowed install bundles');
}).catch((err) => {
console.error(`Failed to add allowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -188,15 +192,17 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to remove allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing allowed install bundles');
});
```
......@@ -234,15 +240,17 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to remove allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing allowed install bundles');
});
```
......@@ -285,15 +293,15 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in removing allowed install bundles');
}).catch((err) => {
console.error(`Failed to remove allowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -329,14 +337,16 @@ getAllowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getAllowedInstallBundles(wantTemp, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
bundleManager.getAllowedInstallBundles(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting allowed install bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -373,14 +383,16 @@ getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
bundleManager.getAllowedInstallBundles(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to get allowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting allowed install bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -422,13 +434,14 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;stri
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
bundleManager.getAllowedInstallBundles(wantTemp, 100).then((result) => {
console.info(`Succeeded in getting allowed install bundles, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get allowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -465,15 +478,17 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to add disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed install bundles');
});
```
......@@ -511,15 +526,17 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to add disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed install bundles');
});
```
......@@ -562,15 +579,15 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in adding disallowed install bundles');
}).catch((err) => {
console.error(`Failed to add disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -607,15 +624,17 @@ removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: As
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to remove disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed install bundles');
});
```
......@@ -653,15 +672,17 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to remove disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed install bundles');
});
```
......@@ -704,15 +725,15 @@ removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: num
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in removing disallowed install bundles');
}).catch((err) => {
console.error(`Failed to remove disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -748,14 +769,16 @@ getDisallowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;str
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedInstallBundles(wantTemp, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
bundleManager.getDisallowedInstallBundles(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed install bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -792,14 +815,16 @@ getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
bundleManager.getDisallowedInstallBundles(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to get disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed install bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -841,14 +866,16 @@ getDisallowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;s
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
bundleManager.getDisallowedInstallBundles(wantTemp, 100).then((result) => {
console.info(`Succeeded in getting disallowed install bundles, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
## bundleManager.addDisallowedUninstallBundles
......@@ -883,15 +910,17 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: Asy
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to add disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed uninstall bundles');
});
```
......@@ -929,15 +958,17 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: numbe
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to add disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed uninstall bundles');
});
```
......@@ -980,15 +1011,15 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: numb
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in adding disallowed uninstall bundles');
}).catch((err) => {
console.error(`Failed to add disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1025,15 +1056,17 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback:
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to remove disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed uninstall bundles');
});
```
......@@ -1071,15 +1104,17 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: nu
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to remove disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed uninstall bundles');
});
```
......@@ -1122,15 +1157,15 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: n
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in removing disallowed uninstall bundles');
}).catch((err) => {
console.error(`Failed to remove disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1166,16 +1201,16 @@ getDisallowedUninstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;s
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedUninstallBundles(wantTemp, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
bundleManager.getDisallowedUninstallBundles(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed uninstall bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -1212,16 +1247,16 @@ getDisallowedUninstallBundles(admin: Want, userId: number, callback: AsyncCallba
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
bundleManager.getDisallowedUninstallBundles(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to get disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed uninstall bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -1263,13 +1298,14 @@ getDisallowedUninstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((data) => {
console.log("success: " + data);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((result) => {
console.info(`Succeeded in getting disallowed uninstall bundles, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1306,16 +1342,15 @@ uninstall(admin: Want, bundleName: string, callback: AsyncCallback&lt;void&gt;):
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, "bundleName", (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
bundleManager.uninstall(wantTemp, 'bundleName', (err) => {
if (err) {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in uninstalling bundles');
});
```
......@@ -1353,16 +1388,15 @@ uninstall(admin: Want, bundleName: string, userId: number, callback: AsyncCallba
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, "bundleName", 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
bundleManager.uninstall(wantTemp, 'bundleName', 100, (err) => {
if (err) {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in uninstalling bundles');
});
```
......@@ -1400,16 +1434,15 @@ uninstall(admin: Want, bundleName: string, isKeepData: boolean, callback: AsyncC
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, "bundleName", true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
bundleManager.uninstall(wantTemp, 'bundleName', true, (err) => {
if (err) {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in uninstalling bundles');
});
```
......@@ -1448,16 +1481,15 @@ uninstall(admin: Want, bundleName: string, userId: number, isKeepData: boolean,
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, "bundleName", 100, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
bundleManager.uninstall(wantTemp, 'bundleName', 100, true, (err) => {
if (err) {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in uninstalling bundles');
});
```
......@@ -1501,12 +1533,13 @@ uninstall(admin: Want, bundleName: string, userId?: number, isKeepData?: boolean
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, "bundleName", 100, true).then(() => {
console.log("success.");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
bundleManager.uninstall(wantTemp, 'bundleName', 100, true).then(() => {
console.info('Succeeded in uninstalling bundles');
}).catch((err) => {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
});
```
\ No newline at end of file
......@@ -46,13 +46,16 @@ setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.setDateTime(wantTemp, 1526003846000, (err) => {
if (err) {
console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in setting date time');
})
```
......@@ -94,12 +97,14 @@ setDateTime(admin: Want, time: number): Promise\<void>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in setting date time');
}).catch((err) => {
console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -136,13 +141,16 @@ disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.disallowModifyDateTime(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in disallowing modify date time');
})
```
......@@ -184,12 +192,14 @@ disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in disallowing modify date time');
}).catch((err) => {
console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -225,13 +235,16 @@ isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in querying modify date time is disallowed : ${result}`);
})
```
......@@ -272,11 +285,13 @@ isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then((result) => {
console.info(`Succeeded in querying modify date time is disallowed : ${result}`);
}).catch((err) => {
console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`);
})
```
\ No newline at end of file
......@@ -45,13 +45,16 @@ resetFactory(admin: Want, callback: AsyncCallback\<void>): void
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
deviceControl.resetFactory(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
deviceControl.resetFactory(wantTemp, (err) => {
if (err) {
console.error(`Failed to reset factory. Code is ${err.code}, message is ${err.message}`);
return;
}
console.log('Succeeded in resetting factory');
})
```
......@@ -92,11 +95,12 @@ resetFactory(admin: Want): Promise\<void>
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
deviceControl.resetFactory(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to reset factory. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -45,15 +45,16 @@ getDeviceSerial(admin: Want, callback: AsyncCallback&lt;string&gt;): void
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceSerial(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDeviceSerial(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get device serial. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting device serial, result : ${result}`);
});
```
......@@ -94,13 +95,14 @@ getDeviceSerial(admin: Want): Promise&lt;string&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceSerial(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting device serial, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get device serial. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -136,15 +138,16 @@ getDisplayVersion(admin: Want, callback: AsyncCallback&lt;string&gt;): void;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDisplayVersion(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDisplayVersion(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get display version. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting display version, result : ${result}`);
});
```
......@@ -185,13 +188,14 @@ getDisplayVersion(admin: Want): Promise&lt;string&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDisplayVersion(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting display version, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get display version. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -227,15 +231,16 @@ getDeviceName(admin: Want, callback: AsyncCallback&lt;string&gt;): void
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceName(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDeviceName(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get device name. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting device name, result : ${result}`);
});
```
......@@ -276,12 +281,13 @@ getDeviceName(admin: Want): Promise&lt;string&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceName(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting device name, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get device name. Code: ${err.code}, message: ${err.message}`);
});
```
\ No newline at end of file
......@@ -44,15 +44,16 @@ getScreenOffTime(admin: Want, callback: AsyncCallback&lt;number&gt;): void
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceSettings.getScreenOffTime(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceSettings.getScreenOffTime(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get screen off time. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting screen off time, result : ${result}`);
});
```
......@@ -93,12 +94,13 @@ getScreenOffTime(admin: Want): Promise&lt;number&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceSettings.getScreenOffTime(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting screen off time, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get screen off time. Code: ${err.code}, message: ${err.message}`);
});
```
\ No newline at end of file
......@@ -45,15 +45,16 @@ getAllNetworkInterfaces(admin: Want, callback: AsyncCallback&lt;Array&lt;string&
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getAllNetworkInterfaces(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(JSON.stringify(result));
networkManager.getAllNetworkInterfaces(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get all network interfaces. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting all network interfaces, result : ${JSON.stringify(result)}`);
});
```
......@@ -94,13 +95,14 @@ getAllNetworkInterfaces(admin: Want): Promise&lt;Array&lt;string&gt;&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getAllNetworkInterfaces(wantTemp).then((result) => {
console.log(JSON.stringify(result));
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting all network interfaces, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get all network interfaces. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -137,15 +139,16 @@ getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback&lt;s
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getIpAddress(wantTemp, "eth0", (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
networkManager.getIpAddress(wantTemp, 'eth0', (err, result) => {
if (err) {
console.error(`Failed to get ip address. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting ip address, result : ${result}`);
});
```
......@@ -187,13 +190,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getIpAddress(wantTemp, "eth0").then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
networkManager.getIpAddress(wantTemp, 'eth0').then((result) => {
console.info(`Succeeded in getting ip address, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get ip address. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -230,21 +234,22 @@ getMac(admin: Want, networkInterface: string, callback: AsyncCallback&lt;string&
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getMac(wantTemp, "eth0", (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
networkManager.getMac(wantTemp, 'eth0', (err, result) => {
if (err) {
console.error(`Failed to get mac. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting mac, result : ${result}`);
});
```
## networkManager.getMac
getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
getMac(admin: Want, networkInterface: string): Promise\<string>;
指定设备管理员应用根据networkInterface获取设备MAC地址,使用Promise形式返回设备IP地址。
......@@ -280,13 +285,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.getMac(wantTemp, "eth0").then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
networkManager.getMac(wantTemp, 'eth0').then((result) => {
console.info(`Succeeded in getting mac, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get mac. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -323,15 +329,16 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: Asyn
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0", (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("result:" + result);
networkManager.isNetworkInterfaceDisabled(wantTemp, 'eth0', (err, result) => {
if (err) {
console.error(`Failed to query network interface is disabled or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying network interface is disabled or not, result : ${result}`);
});
```
......@@ -373,13 +380,14 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise&lt;bo
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0").then((result) => {
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
networkManager.isNetworkInterfaceDisabled(wantTemp, 'eth0').then((result) => {
console.info(`Succeeded in querying network interface is disabled or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query network interface is disabled or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -417,15 +425,16 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("setNetworkInterfaceDisabled success!");
networkManager.setNetworkInterfaceDisabled(wantTemp, 'eth0', true, (err) => {
if (err) {
console.error(`Failed to set network interface disabled. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in setting network interface disabled`);
});
```
......@@ -468,12 +477,13 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true).then(() => {
console.log("setNetworkInterfaceDisabled success!");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
networkManager.setNetworkInterfaceDisabled(wantTemp, 'eth0', true).then(() => {
console.info(`Succeeded in setting network interface disabled`);
}).catch((err) => {
console.error(`Failed to set network interface disabled. Code: ${err.code}, message: ${err.message}`);
});
```
\ No newline at end of file
......@@ -45,15 +45,16 @@ isWifiActive(admin: Want, callback: AsyncCallback&lt;boolean&gt;): void
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
wifiManager.isWifiActive(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("result:" + result);
wifiManager.isWifiActive(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in query is wifi active or not, result : ${result}`);
});
```
......@@ -94,13 +95,14 @@ isWifiActive(admin: Want): Promise&lt;boolean&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
wifiManager.isWifiActive(wantTemp).then((result) => {
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in query is wifi active or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -137,20 +139,21 @@ setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback&lt;voi
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
let profile: wifiManager.WifiProfile = {
'ssid': 'name',
'preSharedKey': 'passwd',
'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("set wifi success");
wifiManager.setWifiProfile(wantTemp, profile, (err) => {
if (err) {
console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in setting wifi profile');
});
```
......@@ -192,18 +195,19 @@ setWifiProfile(admin: Want, profile: WifiProfile): Promise&lt;void&gt;
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
'ssid': 'name',
'preSharedKey': 'passwd',
'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in setting wifi profile');
}).catch((err) => {
console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册