提交 cab9764e 编写于 作者: E ester.zhou

Update docs (10239)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 33d56ea2
......@@ -6,41 +6,41 @@ The **screenlock** module is a system module in OpenHarmony. It provides APIs fo
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import screenlock from '@ohos.screenLock';
```
## screenlock.isScreenLocked
isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the screen is locked. This API uses an asynchronous callback to return the result.
> **NOTE**
>
>This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked<sup>9+</sup>](#screenlockislocked9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. Returns **true** if the screen is locked; returns **false** otherwise.|
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ----------------------------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. The value **true** means that the screen is locked, and **false** means the opposite.|
**Example**
```js
screenlock.isScreenLocked((err, data)=>{
if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
return;
}
console.info('isScreenLocked callback success data -> ${JSON.stringify(data)}');
});
```
```js
screenlock.isScreenLocked((err, data)=>{
if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
return;
}
console.info('isScreenLocked callback success data -> ${JSON.stringify(data)}');
});
```
## screenlock.isScreenLocked
......@@ -48,109 +48,155 @@ isScreenLocked(): Promise&lt;boolean&gt;
Checks whether the screen is locked. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked<sup>9+</sup>](#screenlockislocked9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
| Type | Description |
| ---------------------- | ------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the screen is locked, and **false** means the opposite.|
**Example**
```js
screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => {
console.error('isScreenLocked fail, promise: err -> ${JSON.stringify(err)}');
});
```
```js
screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => {
console.error('isScreenLocked fail, promise: err -> ${JSON.stringify(err)}');
});
```
## screenlock.isLocked<sup>9+</sup>
isLocked(): boolean
Checks whether the screen is locked. This API returns the result synchronously.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type | Description |
| ------- | ------------------------------------------------- |
| boolean | Returns **true** if the screen is locked; returns **false** otherwise.|
**Example**
```js
let isLocked = screenlock.isLocked();
```
## screenlock.isSecureMode
isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the device is in secure mode. This API uses an asynchronous callback to return the result.
Checks whether a device is in secure mode. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure<sup>9+</sup>](#screenlockissecure9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. Returns **true** if the device is in secure mode; returns **false** otherwise.|
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. The value **true** means that the device is in secure mode, and **false** means the opposite.|
**Example**
```js
screenlock.isSecureMode((err, data)=>{
if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
return;
}
console.info('isSecureMode callback success data -> ${JSON.stringify(err)}');
});
```
```js
screenlock.isSecureMode((err, data)=>{
if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
return;
}
console.info('isSecureMode callback success data -> ${JSON.stringify(err)}');
});
```
## screenlock.isSecureMode
isSecureMode(): Promise&lt;boolean&gt;
Checks whether a device is in secure mode. This API uses a promise to return the result.
Checks whether the device is in secure mode. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure<sup>9+</sup>](#screenlockissecure9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
| Type | Description |
| ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the device is in secure mode, and **false** means the opposite.|
**Example**
```js
screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => {
console.error('isSecureMode fail, promise: err->${JSON.stringify(err)}');
});
```
```js
screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => {
console.error('isSecureMode fail, promise: err->${JSON.stringify(err)}');
});
```
## screenlock.isSecure<sup>9+</sup>
isSecure(): boolean
Checks whether the device is in secure mode.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | The value **true** means that the device is in secure mode, and **false** means the opposite.|
**Example**
```js
let isSecure = screenlock.isSecure();
```
## screenlock.unlockScreen
unlockScreen(callback: AsyncCallback&lt;void&gt;): void
Unlocks the screen. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock<sup>9+</sup>](#screenlockunlock9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | --------------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation fails, an error message is returned.|
**Example**
```js
screenlock.unlockScreen((err) => {
if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
return;
}
console.info('unlockScreen callback success');
});
```
```js
screenlock.unlockScreen((err) => {
if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
return;
}
console.info('unlockScreen callback success');
});
```
## screenlock.unlockScreen
......@@ -158,80 +204,131 @@ unlockScreen(): Promise&lt;void&gt;
Unlocks the screen. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock<sup>9+</sup>](#screenlockunlock9) instead.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Example**
```js
screenlock.unlockScreen().then(() => {
console.log('unlockScreen success');
}).catch((err) => {
console.error('unlockScreen fail, promise: err->${JSON.stringify(err)}');
});
```
```js
screenlock.unlockScreen().then(() => {
console.log('unlockScreen success');
}).catch((err) => {
console.error('unlockScreen fail, promise: err->${JSON.stringify(err)}');
});
```
## screenlock.unlock<sup>9+</sup>
## screenlock.lockScreen<sup>9+</sup>
unlock(callback: AsyncCallback&lt;boolean&gt;): void
lockScreen(callback: AsyncCallback&lt;boolean&gt;): void
Unlocks the screen. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
Locks the screen. This API uses an asynchronous callback to return the result.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. The value **true** means that the screen is unlocked successfully, and **false** means the opposite.|
**Example**
```js
screenlock.unlock((err,data) => {
if (err) {
console.error('unlock error -> ${JSON.stringify(err)}');
return;
}
console.info('unlock success data -> ${JSON.stringify(data)}');
});
```
## screenlock.unlock<sup>9+</sup>
unlock(): Promise&lt;boolean&gt;
Unlocks the screen. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
**Return value**
| Type | Description |
| ------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the screen is unlocked successfully, and **false** means the opposite.|
**Example**
```js
screenlock.unlock().then((data) => {
console.log('unlock success');
}).catch((err) => {
console.error('unlock fail, : err->${JSON.stringify(err)}');
});
```
## screenlock.lock<sup>9+</sup>
lock(callback: AsyncCallback&lt;boolean&gt;): void
Locks the screen. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation fails, an error message is returned.|
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ---------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. The value **true** means that the screen is locked successfully, and **false** means the opposite.|
**Example**
```js
screenlock.lockScreen((err) => {
if (err) {
console.error('lockScreen callback error -> ${JSON.stringify(err)}');
return;
}
console.info('lockScreen callback success');
});
```
```js
screenlock.lock((err,data) => {
if (err) {
console.error('lock callback error -> ${JSON.stringify(err)}');
return;
}
console.info('lock callback success');
});
```
## screenlock.lockScreen<sup>9+</sup>
## screenlock.lock<sup>9+</sup>
lockScreen(): Promise&lt;boolean&gt;
lock(): Promise&lt;boolean&gt;
Locks the screen. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type | Description |
| ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the screen is locked successfully, and **false** means the opposite.|
**Example**
```js
screenlock.lockScreen().then(() => {
console.log('lockScreen success');
}).catch((err) => {
console.error('lockScreen fail, promise: err->${JSON.stringify(err)}');
});
```
```js
screenlock.lock().then((data) => {
console.log('lock success');
}).catch((err) => {
console.error('lock fail, promise: err->${JSON.stringify(err)}');
});
```
## EventType
......@@ -239,22 +336,22 @@ Defines the system event type.
**System capability**: SystemCapability.MiscServices.ScreenLock
| Name| Description|
| -------- | -------- |
| beginWakeUp | Wakeup starts when the event starts.|
| endWakeUp | Wakeup ends when the event ends.|
| beginScreenOn | Screen turn-on starts when the event starts.|
| endScreenOn | Screen turn-on ends when the event ends.|
| beginScreenOff | Screen turn-off starts when the event starts.|
| endScreenOff | Screen turn-off ends when the event ends.|
| unlockScreen | The screen is unlocked.|
| lockScreen | The screen is locked.|
| beginExitAnimation | Animation starts to exit.|
| beginSleep | The screen enters sleep mode.|
| endSleep | The screen exits sleep mode.|
| changeUser | The user is switched.|
| screenlockEnabled | Screen lock is enabled.|
| serviceRestart | The screen lock service is restarted.|
| Event Type | Description |
| ------------------ | ------------------------ |
| beginWakeUp | Wakeup starts when the event starts.|
| endWakeUp | Wakeup ends when the event ends.|
| beginScreenOn | Screen turn-on starts when the event starts.|
| endScreenOn | Screen turn-on ends when the event ends.|
| beginScreenOff | Screen turn-off starts when the event starts.|
| endScreenOff | Screen turn-off ends when the event ends.|
| unlockScreen | The screen is unlocked. |
| lockScreen | The screen is locked. |
| beginExitAnimation | Animation starts to exit. |
| beginSleep | The screen enters sleep mode. |
| endSleep | The screen exits sleep mode. |
| changeUser | The user is switched. |
| screenlockEnabled | Screen lock is enabled. |
| serviceRestart | The screen lock service is restarted. |
## SystemEvent
......@@ -263,10 +360,10 @@ Defines the structure of the system event callback.
**System capability**: SystemCapability.MiscServices.ScreenLock
| Name| Description|
| -------- | -------- |
| eventType | System event type.|
| params | System event parameters.|
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ------------- |
| eventType | [EventType](#eventtype) | Yes | System event type.|
| params | string | Yes | System event parameters.|
## screenlock.onSystemEvent<sup>9+</sup>
......@@ -276,87 +373,84 @@ Registers a callback for system events related to screen locking.
**System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | Callback\<SystemEvent\> | Yes| Callback for system events related to screen locking|
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ---------------------------- |
| callback | Callback\<[SystemEvent](#systemevent)> | Yes | Callback for system events related to screen locking.|
**Return value**
| Type | Description |
| ------- | -------------------------------------------- |
| boolean | The value **true** means that the callback is registered successfully, and **false** means the opposite.|
| Type | Description |
| ------- | ------------------------------------------------- |
| boolean | Returns **true** if the callback is registered successfully; returns **false** otherwise.|
**Example**
```js
let isSuccess = screenlock.onSystemEvent((err, event)=>{
console.log(`onSystemEvent:callback:${event.eventType}`)
if (err) {
console.log(`onSystemEvent callback error -> ${JSON.stringify(err)}`);
}
});
if (!isSuccess) {
console.log(`onSystemEvent result is false`)
}
```
```js
let isSuccess = screenlock.onSystemEvent((event)=>{
console.log(`onSystemEvent:callback:${event.eventType}`)
});
if (!isSuccess) {
console.log(`onSystemEvent result is false`)
}
```
## screenlock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback\<boolean\>): void
sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback\<boolean>): void
Sends an event to the screen lock service. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | String | Yes| Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"screenDrawDone"**: Screen drawing is complete.|
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
| callback | AsyncCallback\<boolean\> | Yes| Callback used to return the result.|
| Name | Type | Mandatory| Description |
| --------- | ------------------------ | ---- | -------------------- |
| event | String | Yes | Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"screenDrawDone"**: Screen drawing is complete.|
| parameter | number | Yes | Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** means that the operation is successful, and **false** means the opposite. |
**Example**
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
console.log('sending result:' + result);
});
```
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
console.log('sending result:' + result);
});
```
## screenlock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise\<boolean\>
sendScreenLockEvent(event: String, parameter: number): Promise\<boolean>
Sends an event to the screen lock service. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | String | Yes| Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"screenDrawDone"**: Screen drawing is complete.|
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock fails.<br>- **2**: The unlock is canceled.|
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | --------------------------------------- |
| event | String | Yes | Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"screenDrawDone"**: Screen drawing is complete.|
| parameter | number | Yes | Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise\<boolean\> | Promise used to return the result.|
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean> | Promise used to return the result. The value **true** means that the operation is successful, and **false** means the opposite.|
**Example**
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.log('sending result:' + result);
});
```
```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.log('sending result:' + result);
});
```
......@@ -17,14 +17,14 @@ import wallpaper from '@ohos.wallpaper';
## WallpaperType
Defines the wallpaper type.
Enumerates the wallpaper types.
**System capability**: SystemCapability.MiscServices.Wallpaper
| Name| Description|
| -------- | -------- |
| WALLPAPER_LOCKSCREEN | Lock screen wallpaper.|
| WALLPAPER_SYSTEM | Home screen wallpaper.|
| Name| Value|Description|
| -------- | -------- |-------- |
| WALLPAPER_SYSTEM | 0 |Home screen wallpaper.|
| WALLPAPER_LOCKSCREEN | 1 |Lock screen wallpaper.|
## wallpaper.getColors
......@@ -33,6 +33,10 @@ getColors(wallpaperType: WallpaperType, callback: AsyncCallback&lt;Array&lt;Rgba
Obtains the main color information of the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync<sup>9+</sup>](#wallpapergetcolorssync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -61,6 +65,10 @@ getColors(wallpaperType: WallpaperType): Promise&lt;Array&lt;RgbaColor&gt;&gt;
Obtains the main color information of the wallpaper of the specified type. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync<sup>9+</sup>](#wallpapergetcolorssync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -86,12 +94,43 @@ Obtains the main color information of the wallpaper of the specified type. This
```
## wallpaper.getColorsSync<sup>9+</sup>
getColorsSync(wallpaperType: WallpaperType): Array&lt;RgbaColor&gt;
Obtains the main color information of the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| Array&lt;[RgbaColor](#rgbacolor)&gt; | Promise used to return the main color information of the wallpaper.|
**Example**
```js
var colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
```
## wallpaper.getId
getId(wallpaperType: WallpaperType, callback: AsyncCallback&lt;number&gt;): void
Obtains the ID of the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync<sup>9+</sup>](#wallpapergetidsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -120,8 +159,11 @@ getId(wallpaperType: WallpaperType): Promise&lt;number&gt;
Obtains the ID of the wallpaper of the specified type. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync<sup>9+</sup>](#wallpapergetidsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -146,12 +188,43 @@ Obtains the ID of the wallpaper of the specified type. This API uses a promise t
```
## wallpaper.getIdSync<sup>9+</sup>
getIdSync(wallpaperType: WallpaperType): number
Obtains the ID of the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | ID of the wallpaper. If this type of wallpaper is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to 2^31-1.|
**Example**
```js
var id = wallpaper.getIdSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
```
## wallpaper.getMinHeight
getMinHeight(callback: AsyncCallback&lt;number&gt;): void
Obtains the minimum height of this wallpaper. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync<sup>9+</sup>](#wallpapergetminheightsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -179,8 +252,11 @@ getMinHeight(): Promise&lt;number&gt;
Obtains the minimum height of this wallpaper. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync<sup>9+</sup>](#wallpapergetminheightsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
......@@ -199,14 +275,38 @@ Obtains the minimum height of this wallpaper. This API uses a promise to return
```
## wallpaper.getMinHeightSync<sup>9+</sup>
getMinHeightSync(): number
Obtains the minimum height of this wallpaper. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| number | Promise used to return the minimum wallpaper height, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default height should be used instead.|
**Example**
```js
var minHeight = wallpaper.getMinHeightSync();
```
## wallpaper.getMinWidth
getMinWidth(callback: AsyncCallback&lt;number&gt;): void
Obtains the minimum width of this wallpaper. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync<sup>9+</sup>](#wallpapergetminwidthsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
......@@ -233,13 +333,17 @@ getMinWidth(): Promise&lt;number&gt;
Obtains the minimum width of this wallpaper. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync<sup>9+</sup>](#wallpapergetminwidthsync9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promised used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead.|
| Promise&lt;number&gt; | Promise used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead.|
**Example**
......@@ -252,19 +356,44 @@ Obtains the minimum width of this wallpaper. This API uses a promise to return t
```
## wallpaper.getMinWidthSync<sup>9+</sup>
getMinWidthSync(): number
Obtains the minimum width of this wallpaper. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| number | Promise used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead.|
**Example**
```js
var minWidth = wallpaper.getMinWidthSync();
```
## wallpaper.isChangePermitted
isChangePermitted(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether to allow the application to change the wallpaper for the current user. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed<sup>9+</sup>](#wallpaperischangeallowed9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return whether to allow the application to change the wallpaper for the current user. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
......@@ -285,13 +414,17 @@ isChangePermitted(): Promise&lt;boolean&gt;
Checks whether to allow the application to change the wallpaper for the current user. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed<sup>9+</sup>](#wallpaperischangeallowed9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise.|
| Promise&lt;boolean&gt; | Promise used to return whether to allow the application to change the wallpaper for the current user. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
......@@ -304,19 +437,44 @@ Checks whether to allow the application to change the wallpaper for the current
```
## wallpaper.isChangeAllowed<sup>9+</sup>
isChangeAllowed(): boolean
Checks whether to allow the application to change the wallpaper for the current user. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Whether to allow the application to change the wallpaper for the current user. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
```js
var isChangeAllowed = wallpaper.isChangeAllowed();
```
## wallpaper.isOperationAllowed
isOperationAllowed(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the user is allowed to set wallpapers. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed<sup>9+</sup>](#wallpaperisuserchangeallowed9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return whether the user is allowed to set wallpapers. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
......@@ -337,13 +495,17 @@ isOperationAllowed(): Promise&lt;boolean&gt;
Checks whether the user is allowed to set wallpapers. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed<sup>9+</sup>](#wallpaperisuserchangeallowed9) instead.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise.|
| Promise&lt;boolean&gt; | Promise used to return whether the user is allowed to set wallpapers. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
......@@ -356,12 +518,37 @@ Checks whether the user is allowed to set wallpapers. This API uses a promise to
```
## wallpaper.isUserChangeAllowed<sup>9+</sup>
isUserChangeAllowed(): boolean
Checks whether the user is allowed to set wallpapers. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Wallpaper
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Whether the user is allowed to set wallpapers. The value **true** means that the operation is allowed, and **false** means the opposite.|
**Example**
```js
var isUserChangeAllowed = wallpaper.isUserChangeAllowed();
```
## wallpaper.reset
reset(wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
Resets the wallpaper of the specified type to the default wallpaper. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore<sup>9+</sup>](#wallpaperrestore9) instead.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -392,6 +579,10 @@ reset(wallpaperType: WallpaperType): Promise&lt;void&gt;
Resets the wallpaper of the specified type to the default wallpaper. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore<sup>9+</sup>](#wallpaperrestore9) instead.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -419,12 +610,79 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us
```
## wallpaper.restore<sup>9+</sup>
restore(wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
Resets the wallpaper of the specified type to the default wallpaper. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, the result of removal is returned. Otherwise, error information is returned.|
**Example**
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error(`failed to restore because: ` + JSON.stringify(error));
return;
}
console.log(`success to restore.`);
});
```
## wallpaper.restore<sup>9+</sup>
restore(wallpaperType: WallpaperType): Promise&lt;void&gt;
Resets the wallpaper of the specified type to the default wallpaper. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned.|
**Example**
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to restore.`);
}).catch((error) => {
console.error(`failed to restore because: ` + JSON.stringify(error));
});
```
## wallpaper.setWallpaper
setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
Sets a specified source as the wallpaper of a specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage<sup>9+</sup>](#wallpapersetimage9) instead.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -433,7 +691,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| source | string \|[PixelMap](js-apis-image.md#pixelmap7) | | URI of a JPEG or PNG file, or bitmap of a PNG file.|
| source | string \|[image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.|
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned.|
......@@ -479,6 +737,10 @@ setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Pro
Sets a specified source as the wallpaper of a specified type. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage<sup>9+</sup>](#wallpapersetimage9) instead.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -487,7 +749,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| source | string \|[PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.|
| source | string \|[image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.|
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
......@@ -499,7 +761,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr
**Example**
```js
// The source type is string.
//The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to setWallpaper.`);
......@@ -527,12 +789,126 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr
});
```
## wallpaper.setImage<sup>9+</sup>
setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
Sets a specified source as the wallpaper of a specified type. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| source | string \|[image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.|
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned.|
**Example**
```js
//The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error(`failed to setImage because: ` + JSON.stringify(error));
return;
}
console.log(`success to setImage.`);
});
// The source type is image.PixelMap.
import image from '@ohos.multimedia.image';
let imageSource = image.createImageSource("file://" + wallpaperPath);
let opts = {
"desiredSize": {
"height": 3648,
"width": 2736
}
};
imageSource.createPixelMap(opts).then((pixelMap) => {
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error(`failed to setImage because: ` + JSON.stringify(error));
return;
}
console.log(`success to setImage.`);
});
}).catch((error) => {
console.error(`failed to createPixelMap because: ` + JSON.stringify(error));
});
```
## wallpaper.setImage<sup>9+</sup>
setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise&lt;void&gt;
Sets a specified source as the wallpaper of a specified type. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.SET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| source | string \|[image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.|
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned.|
**Example**
```js
//The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to setImage.`);
}).catch((error) => {
console.error(`failed to setImage because: ` + JSON.stringify(error));
});
// The source type is image.PixelMap.
import image from '@ohos.multimedia.image';
let imageSource = image.createImageSource("file://" + wallpaperPath);
let opts = {
"desiredSize": {
"height": 3648,
"width": 2736
}
};
imageSource.createPixelMap(opts).then((pixelMap) => {
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to setImage.`);
}).catch((error) => {
console.error(`failed to setImage because: ` + JSON.stringify(error));
});
}).catch((error) => {
console.error(`failed to createPixelMap because: ` + JSON.stringify(error));
});
```
## wallpaper.getFile<sup>8+</sup>
getFile(wallpaperType: WallpaperType, callback: AsyncCallback&lt;number&gt;): void
Obtains the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync<sup>9+</sup>](#wallpapergetfilesync9) instead.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -562,6 +938,10 @@ getFile(wallpaperType: WallpaperType): Promise&lt;number&gt;
Obtains the wallpaper of the specified type. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync<sup>9+</sup>](#wallpapergetfilesync9) instead.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -589,12 +969,45 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t
```
## wallpaper.getFileSync<sup>9+</sup>
getFileSync(wallpaperType: WallpaperType): number;
Obtains the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Promise used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.|
**Example**
```js
var file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
```
## wallpaper.getPixelMap
getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback&lt;image.PixelMap&gt;): void;
Obtains the pixel map for the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage<sup>9+</sup>](#wallpapergetimage9) instead.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -606,7 +1019,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses an
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes| Callback used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
**Example**
......@@ -624,6 +1037,10 @@ getPixelMap(wallpaperType: WallpaperType): Promise&lt;image.PixelMap&gt;
Obtains the pixel map for the wallpaper of the specified type. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage<sup>9+</sup>](#wallpapergetimage9) instead.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
......@@ -640,7 +1057,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
| Promise&lt;image.PixelMap&gt; | Promise used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
**Example**
......@@ -655,7 +1072,73 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p
```
## wallpaper.on('colorChange')
## wallpaper.getImage<sup>9+</sup>
getImage(wallpaperType: WallpaperType, callback: AsyncCallback&lt;image.PixelMap&gt;): void;
Obtains the pixel map for the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
| callback | AsyncCallback&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Yes| Callback used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
**Example**
```js
wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM, function (err, data) {
console.info('wallpaperXTS ===> testgetImageCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testgetImageCallbackSystem data : ' + JSON.stringify(data));
});
```
## wallpaper.getImage<sup>9+</sup>
getImage(wallpaperType: WallpaperType): Promise&lt;image.PixelMap&gt;
Obtains the pixel map for the wallpaper of the specified type. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WALLPAPER
**System capability**: SystemCapability.MiscServices.Wallpaper
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Promise used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.|
**Example**
```js
wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.info('wallpaperXTS ===> testgetImagePromiseSystem data : ' + data);
console.info('wallpaperXTS ===> testgetImagePromiseSystem data : ' + JSON.stringify(data));
}).catch((err) => {
console.info('wallpaperXTS ===> testgetImagePromiseSystem err : ' + err);
console.info('wallpaperXTS ===> testgetImagePromiseSystem err : ' + JSON.stringify(err));
});
```
## wallpaper.on('colorChange')<sup>9+</sup>
on(type: 'colorChange', callback: (colors: Array&lt;RgbaColor&gt;, wallpaperType: WallpaperType) =&gt; void): void
......@@ -680,7 +1163,7 @@ Subscribes to the wallpaper color change event.
```
## wallpaper.off('colorChange')
## wallpaper.off('colorChange')<sup>9+</sup>
off(type: 'colorChange', callback?: (colors: Array&lt;RgbaColor&gt;, wallpaperType: WallpaperType) =&gt; void): void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册