com.awareframework.ios.sensor.device 0.4.0

com.awareframework.ios.sensor.device 0.4.0

tetujinyuuki.nishiyama 维护。



  • tetujin

AWARE:设备

CI Status Version License Platform

设备传感器提供设备制造商、型号、操作系统版本和其他信息。这些信息由 UIDevice 提供。

要求

iOS 10 或更高版本

安装

com.aware.ios.sensor.device 通过 CocoaPods 提供。

  1. 要安装它,只需将以下行添加到 Podfile 中
pod 'com.awareframework.ios.sensor.device'
  1. 将 com.awareframework.ios.sensor.device 库导入到您的源代码中。
import com_awareframework_ios_sensor_device

公共函数

DeviceSensor

  • init(config:DeviceSensor.Config?) : 使用可选配置初始化设备传感器。
  • start():使用可选配置启动设备传感器。
  • stop():停止服务。

DeviceSensor.Config

用于存储传感器配置的类。

Fields

  • sensorObserver: DeviceObserver?:实时数据更新回调。
  • enabled: Boolean 传感器是否启用。(默认 = false
  • debug: Boolean 打开/关闭将日志记录到 Logcat。(默认 = false
  • label: String 数据标签。(默认 = "")
  • deviceId: String 与事件和传感器相关联的设备的ID。(默认 = "")
  • dbEncryptionKey 数据库加密密钥。(默认 = null
  • dbType: Engine 用于保存数据的数据库引擎。(默认 = Engine.DatabaseType.REALM
  • dbPath: String 数据库路径。(默认 = "aware_device")
  • dbHost: String 数据库同步的主机。(默认 = null

Broadcasts

  • DeviceSensor.ACTION_AWARE_DEVICE 当设备被分析时触发。

Data Representations

Device Data

字段 类型 描述
systemName String 由接收器表示的设备上运行的操作系统名称。(例如,iOS)
systemVersion String 当前操作系统的版本。(例如,12.1)
product String 设备的设备名称。(例如,iPhone 7)
model String 设备的型号。(例如,iPhone)
localizedModel String 设备的本地化字符串型号。(例如,iPhone)
userInterfaceIdiom Int 当前设备应使用的界面样式。(0=手机,1=平板,2=电视,或3=车载播放)
identifierForVendor String 一个唯一标识设备的字母数字串。
modeCode String 设备的型号代码(例如,iPhone9,1)
osVersion String 从utsname.h获取的OS版本信息(例如,Darwin内核版本18.0.0: 周三 8月 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64)
manufacturer String 设备的制造商名称(例如,Apple)
deviceId String AWARE设备UUID
label String 可定制的标签。对于数据校准或追溯很有用。
timestamp Int64 自1970年开始的unixtime毫秒
timezone Int 设备的时区
os String 设备的操作系统(例如,android)

示例用法

let deviceSensor = DeviceSensor.init(DeviceSensor.Config().apply{config in
    config.debug = true
    config.dbType = .REALM
    config.sensorObserver = Observer()
})
deviceSensor.start()
class Observer:DeviceOserver{
    func onDeviceChanged(data: DeviceData) {
        // Your code here..
    }
}

作者

Yuuki Nishiyama, [email protected]

相关链接

Apple | UIDevice

证书

版权所有(c)2018 AWARE移动上下文仪器中间件/框架(http://www.awareframework.com

根据Apache License,版本2.0(“许可证”);除非遵守许可证,否则不得使用此文件。您可以在以下位置获得许可证副本:

https://apache.ac.cn/licenses/LICENSE-2.0除非适用法律要求或书面同意,在许可证下分发的软件按“原样”提供,不对任何类型(明示或暗示)提供保证或条件。请参阅许可证了解对该许可证下权限和限制的具体语言。