getDeviceProperty(params: Object)

Requires:
DeviceKit≥1.2.6@ray-js/ray≥0.6.23
Platforms:
iOSAndroid
import { device } from '@ray-js/ray';

const { getDeviceProperty } = device;

// Promise usage
try {
  const res = await getDeviceProperty({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Get device properties

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesdeviceId Device ID Supports retrieving other device information across panels. The current panel can pass the current device ID to fetch it
Nodps
complete() => voidNoCompletion callback (executed on both success and failure)
success(params: Object) => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
success callback parameters
PropertyTypeDescriptionDeviceKit Since
Device attribute key-value pairsv3.3.0
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { device } from '@ray-js/ray'

device.getDeviceProperty({
  deviceId: "xx",
  dps: { "xx": {} },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});