智能小程序 Ray 开发基础API——系统 API 合集(二)

getMobileDeviceInfo

获取设备基础信息

引入

import { getMobileDeviceInfo } from '@ray-js/ray';

需引入BaseKit,且在>=2.4.3版本才可使用

参数

Object object

属性 类型 默认值 必填 说明
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数

object.success 回调参数

参数

Object res

属性 类型 说明
abi string 应用二进制接口类型(仅 Android 支持)
brand string 设备品牌
model string 设备型号。新机型刚推出一段时间会显示 unknown。
system string 操作系统及版本
platform string 客户端平台

object.fail 回调参数

参数

Object res

属性 类型 说明
errorMsg string 插件错误信息
errorCode string 错误码
innerError object 插件外部依赖错误信息 {errorMsg: string, errorCode: string }

 

openSystemBluetoothSetting

跳转系统蓝牙设置页 (仅 Android)

引入

import { openSystemBluetoothSetting } from '@ray-js/ray';

需引入BaseKit,且在>=2.4.3版本才可使用

参数

Object object

属性 类型 默认值 必填 说明
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数

 👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。 

 

updateVolume

设置系统音量

错误码标注 入参值范围超出 errorCode = 6, The volume value is invalid, it should be [0 - 1]

引入

import { updateVolume } from '@ray-js/ray';

需引入BaseKit,且在>=2.4.3版本才可使用

参数

Object object

属性 类型 默认值 必填 说明
value number 音量,阈值【0 - 1】
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数

 

registerSystemVolumeChange

注册系统音量监听

关联 API:[onSystemVolumeChangeEvent, unRegisterSystemVolumeChange]

引入

import { registerSystemVolumeChange } from '@ray-js/ray';

需引入BaseKit,且在>=2.5.0版本才可使用

参数

Object object

属性 类型 默认值 必填 说明
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数

 

unRegisterSystemVolumeChange

取消注册系统音量监听

关联 API:[onSystemVolumeChangeEvent, registerSystemVolumeChange]

引入

import { unRegisterSystemVolumeChange } from '@ray-js/ray';

需引入BaseKit,且在>=2.5.0版本才可使用

参数

Object object

属性 类型 默认值 必填 说明
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数

 

onSystemVolumeChangeEvent

系统音量监听通知事件

关联 API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]

引入

import { onSystemVolumeChangeEvent } from '@ray-js/ray';

需引入BaseKit,且在>=2.5.0版本才可使用

参数

function callback

系统音量监听通知事件

关联 API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]的回调函数

回调参数 Object res

属性 类型 默认值 必填 说明
value number 音量,阈值【0 - 1】

 

offSystemVolumeChangeEvent

取消监听:系统音量监听通知事件

关联 API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]

引入

import { offSystemVolumeChangeEvent } from '@ray-js/ray';

需引入BaseKit,且在>=2.5.0版本才可使用

参数

function callback

取消监听:系统音量监听通知事件

关联 API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]的回调函数

回调参数 Object res

属性 类型 默认值 必填 说明
value number 音量,阈值【0 - 1】

 👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。 

相关推荐

  1. 程序API能力汇总——基础容器API

    2024-05-14 17:18:05       41 阅读
  2. 程序基础API系统API接口汇总

    2024-05-14 17:18:05       42 阅读
  3. AI人工智能程序系统开发

    2024-05-14 17:18:05       30 阅读
  4. AI人工智能程序系统开发

    2024-05-14 17:18:05       36 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-14 17:18:05       91 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-14 17:18:05       97 阅读
  3. 在Django里面运行非项目文件

    2024-05-14 17:18:05       78 阅读
  4. Python语言-面向对象

    2024-05-14 17:18:05       88 阅读

热门阅读

  1. 基因专利的得与失

    2024-05-14 17:18:05       34 阅读
  2. Edge的使用心得与深度探索

    2024-05-14 17:18:05       33 阅读
  3. 下拉多选【bootstrap-multiselect】

    2024-05-14 17:18:05       29 阅读
  4. k8s相关常用语句

    2024-05-14 17:18:05       31 阅读
  5. oraclesql中删除表中重复行的方法

    2024-05-14 17:18:05       106 阅读
  6. 遥感中常用的降维方法-UMAP介绍

    2024-05-14 17:18:05       38 阅读
  7. SpringBoot + Druid + Sqlite 文件数据库初体验

    2024-05-14 17:18:05       29 阅读