안드로이드에는 Sensor 종류
int TYPE_ACCELEROMETER A constant describing an accelerometer sensor type. -> 가속도계 센서 타입
int TYPE_ALL A constant describing all sensor types.
int TYPE_AMBIENT_TEMPERATURE A constant describing an ambient temperature sensor type -> 주위 온도 센서 타입 (쓰이는지는 잘모르겠다)
int TYPE_GRAVITY A constant describing a gravity sensor type. -> 중력 센서
int TYPE_GYROSCOPE A constant describing a gyroscope sensor type ->자이로스코프 센서(회전운동, 센서?)
int TYPE_LIGHT A constant describing an light sensor type. -> 광센서
int TYPE_LINEAR_ACCELERATION A constant describing a linear acceleration sensor type. ->선가속도센서
int TYPE_MAGNETIC_FIELD A constant describing a magnetic field sensor type. -> 자기장 센서
int TYPE_ORIENTATION This constant is deprecated. use SensorManager.getOrientation() instead. -> 방향 센서
int TYPE_PRESSURE A constant describing a pressure sensor type -> 압력 센서
int TYPE_PROXIMITY A constant describing an proximity sensor type. -> 근접센서
int TYPE_RELATIVE_HUMIDITY A constant describing a relative humidity sensor type. -> 상대습도 센서
int TYPE_ROTATION_VECTOR A constant describing a rotation vector sensor type. -> 회전센서
int TYPE_TEMPERATURE This constant is deprecated. use Sensor.TYPE_AMBIENT_TEMPERATURE instead. -> 온도 측정 센서
List<Sensor> m_sensorlist = sm.getSensorList(Sensor.TYPE_ALL);
if(!m_sensorlist.isEmpty()){
Sensor snsr;
for(int i=0;i<m_sensorlist.size();i++){
snsr=m_sensorlist.get(i);
String snstyp;
switch(snsr.getType()){
case Sensor.TYPE_ACCELEROMETER : snstyp="TYPE_ACCELEROMETER";break;
case Sensor.TYPE_ALL : snstyp="TYPE_ALL";break;
case Sensor.TYPE_GYROSCOPE : snstyp="TYPE_GYROSCOPE";break;
case Sensor.TYPE_LIGHT : snstyp="TYPE_LIGHT";break;
case Sensor.TYPE_MAGNETIC_FIELD : snstyp="TYPE_MAGNETIC_FIELD";break;
case Sensor.TYPE_ORIENTATION : snstyp="TYPE_ORIENTATION";break;
case Sensor.TYPE_PRESSURE : snstyp="TYPE_PRESSURE";break;
case Sensor.TYPE_PROXIMITY : snstyp="TYPE_PROXIMITY";break;
case Sensor.TYPE_TEMPERATURE : snstyp="TYPE_TEMPERATURE";break;
default: snstyp="UNKNOWN_TYPE "+snsr.getType();break;
}
Log.d(TAG, "Sensor."+snstyp);
}
}
로 조회 결과
가지고 있는 테스트 폰의 갤럭시 S는 아래처럼 나온다. TYPE_GYROSCOPE는 지원을 안해서 값을 알수가 없다.
Sensor.TYPE_ACCELEROMETER
Sensor.TYPE_MAGNETIC_FIELD
Sensor.TYPE_ORIENTATION
Sensor.TYPE_LIGHT
Sensor.TYPE_PROXIMITY
Sensor.UNKNOWN_TYPE 9
Sensor.UNKNOWN_TYPE 10
Sensor.UNKNOWN_TYPE 11