Host - blockdate/ios-rn-sdk GitHub Wiki

miot/Host

扩展程序运行时的宿主环境
所有由宿主APP直接提供给扩展程序的接口均列在这里. 主要包括原生业务页面, 本地数据访问等

Export:
Example

import {Host} from 'miot'

 Host.type // ios/ android/ tv
 Host.isIOS
 Host.isAndroid

 Host.version
 Host.apiLevel
 Host.isDebug


 Host.ui.openDeviceListPage()
 Host.ui.openShopPage(100)

 Host.locale.language
 Host.locale.timezone
 Host.locale.currentTimeMillis.then(time=>{})
 Host.locale.getCurrentCountry().then(country=>{})
 Host.locale.getPlaceMark().then(place=>{})
 Host.locale.getGPS().then(gps=>{})


 Host.file.readFile(path).then(file=>{})
 Host.file.writeFile(path, file).then(ok=>{})

 Host.storage.get(key)
 Host.storage.set(key, value)

miot/Host.type : string

返回本地环境的类型, ios|android

Kind: static constant of miot/Host

miot/Host.systemInfo ⇒ object

系统信息

Kind: static constant of miot/Host
Returns: object - 包含sysVersion 系统版本名称 mobileModel 手机型号

miot/Host.isAndroid : boolean

判断是否是 android

Kind: static constant of miot/Host

miot/Host.isIOS

判断是否 iOS

Kind: static constant of miot/Host

miot/Host.version : string

APP 的版本, 例如"1.0.0"

Kind: static constant of miot/Host

miot/Host.apiLevel : int

APP 的 apiLevel

Kind: static constant of miot/Host

miot/Host.isDebug : boolean

判断是否是调试版本

Kind: static constant of miot/Host
Read only: true

miot/Host.ui

可调起的host业务页面

Kind: static constant of miot/Host
See: module:miot/host/ui

miot/Host.locale

host 的本地化设置, 包括语言,地区,城市等等

Kind: static constant of miot/Host
See: module:miot/host/locale

miot/Host.storage

本地数据存储服务模块

Kind: static constant of miot/Host
See: module:miot/host/storage

miot/Host.file

本地文件服务模块

Kind: static constant of miot/Host
See: module:miot/host/file

miot/Host.audio

音频 播放,录制,转码相关模块

Kind: static constant of miot/Host
See: module:miot/host/audio

miot/Host.crypto

加密解密模块

Kind: static constant of miot/Host
See: module:miot/host/crypto

miot/Host.getWifiInfo() ⇒ Promise

获取手机wifi信息

Kind: static method of miot/Host
Example

Host.getWifiInfo().then(res => console("ssid and bssid = ", res.SSID, res.BSSID))
⚠️ **GitHub.com Fallback** ⚠️