本文概要性地介绍如下内容
1,类架构框图
2,Sensor Server
- 初始化过程
3,Sensor Client
- 初始化过程
- 与Server端通信的建立过程
4,应用开发总结
1,类架构框图
如上图所示,Sensor Framework相对于Audio等模块来说,比较简单,摘录几个关键类的设计意图如下:
/**
* <p>
* SensorManager lets you access the device's {@link android.hardware.Sensor
* sensors}. Get an instance of this class by calling
* {@link android.content.Context#getSystemService(java.lang.String)
* Context.getSystemService()} with the argument
* {@link android.content.Context#SENSOR_SERVICE}.
* </p>
* <p>
* Always make sure to disable sensors you don't need, especially when your
* activity is paused. Failing to do so can drain the battery in just a few
* hours. Note