System

Updated at:

This topic describes the API calls for system information in the custom device panel SDK.

Background information

For more information about how to install the SDK and call APIs, see Getting Started.

Get system information

getSystemInfo

getSystemInfoSync: A synchronous method call.

Request parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

Required

None

-

-

-

-

-

Response parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

info

object

apilevel

Number

The version number of the app SDK.

appEnv

string

The app environment. This parameter is for internal use. The external value is release.

appName

string

The app name. For example, "iLop" for Cloud Intelligence or "TGenie" for Tmall Genie.

appVersion

string

The app version number.

language

string

The app language.

model

string

The mobile phone model.

osVersion

string

The OS version.

pixelRatio

Number

The device pixel ratio.

platform

string

The mobile phone OS platform. Valid values: ios, Android.

runtime

string

The container environment. Currently, only h5 is supported.

screenHeight

Number

The screen height. Unit: px. On Android, the screenHeight value is not accurate. Calculate the correct value using screenHeight/pixelRatio.

screenWidth

Number

The screen width. Unit: px. On Android, the screenWidth value is not accurate. Calculate the correct value using screenWidth/pixelRatio.

sdkVersion

string

The SDK version.

statusBarHeight

Number

The height of the mobile phone status bar.

Call example

import { system } from 'aliyun-livinglink-sdk';

// Asynchronous method call
system.getSystemInfo().then((sysInfo)=>{
   console.log(sysInfo)
}).catch(()=>{
})

 // Synchronous method call
 const sysInfo = system.getSystemInfoSync();
 console.log(sysInfo)

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎

Subscribe to system permission events (Bluetooth, location)

subscribeAll

Request parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

Required

None

-

-

-

-

-

Response parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

result

object

ret

string

The subscription result.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.subscribeAll().then((res)=>{
   console.log(res)
}).catch(()=>{
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✖︎

Unsubscribe from system permission events (Bluetooth, location)

unsubscribeAll

Request parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

Required

None

-

-

-

-

-

Response parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

result

object

ret

string

Subscription Status

Call example

import { system } from 'aliyun-livinglink-sdk';

system.unsubscribeAll().then((res)=>{
   console.log(res)
}).catch(()=>{
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✖︎

Get Bluetooth switch status

getBlueToothEnabled

Request parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

Required

None

-

-

-

-

-

Response parameters

Parameter

Type

Subparameter

Subparameter type

Description

result

object

enable

boolean

true: enabled. false: disabled.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.getBlueToothEnabled().then((res)=>{
   console.log(res)
}).catch(()=>{
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎

Listen for Bluetooth switch status events

onBlueToothEnabledChange

Request parameters

Parameter

Parameter Type

Description

Required

callback

Function

The callback function for the Bluetooth switch status event.

Yes

Response parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

msg

object

enable

boolean

true: enabled. false: disabled.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.subscribeAll().then((res)=>{
   console.log(res)
})
// Subscribe to this event before you use it.
system.onBlueToothEnabledChange((msg)=>{
  console.log(msg)
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✖︎

Get location permission switch status

getLocationEnabled

Request parameters

Parameter

Type

Subparameter

Subparameter type

Description

Required

None

-

-

-

-

-

Response parameters

Parameter

Type

Subparameter

Subparameter type

Description

result

object

enable

boolean

true: enabled. false: disabled.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.getLocationEnabled().then((res)=>{
   console.log(res)
}).catch(()=>{
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎

Listen for location permission switch status events

onLocationEnabledChange

Request parameters

Parameter

Type

Description

Required

callback

Function

The callback function for the location permission switch status event.

Yes

Response parameters

Parameter

Parameter Type

Subparameter

Subparameter type

Description

msg

object

enable

boolean

true: enabled. false: disabled.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.subscribeAll().then((res)=>{
   console.log(res)
})
// Subscribe to this event before you use it.
system.onBlueToothEnabledChange((msg)=>{
  console.log(msg)
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✖︎

Set system status bar text color

setStatusBarStyle

Request parameters

Parameter

Parameter type

Description

Required

barStyle

string

light-content: Sets the status bar text to white.

dark-content: Sets the status bar text to black.

Yes

Response parameters

Parameter

Parameter Type

Subparameter

Subparameter type

Description

None

-

-

-

-

Call example

import { system } from 'aliyun-livinglink-sdk';

system.setStatusBarStyle('light-content')

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎

Get system network status

getNetworkStatus

Request parameters

Parameter

Parameter Type

Description

Required

None

-

-

-

Response parameters

Parameter

Type

Subparameter

Subparameter type

Description

network

string

None

None

The network status of the mobile phone system. Valid values: wifi, cell, others, none, unknown.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.getNetworkStatus().then((networkStatus)=>{
  console.log(networkStatus)
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎

Listen for system network status change events

onNetworkStatusChange

Request parameters

Parameter

Parameter type

Description

Required

callback

Function

The callback function for the system network status change event.

Yes

Response parameters

Parameter

Parameter type

Subparameter

Subparameter type

Description

network

string

None

None

The network status of the mobile phone system. Valid values: wifi, cell, others, none, unknown.

Call example

import { system } from 'aliyun-livinglink-sdk';

system.onNetworkStatusChange((networkStatus)=>{
  console.log(networkStatus)
})

API support

Cloud Intelligence

Proprietary Brand

Tmall Genie

✔︎

✔︎

✔︎