문제

I'm using the proximity sensor in my app, and when I register the sensor I can see in the LogCat this line:

07-11 17:14:26.049: E/SensorManager(26240): registerListener :: handle = 4 name= CM3663 Proximity Sensor delay= 10000 Listener= com.sampler.ProximitySampler@408093c8

Now, I know and it's verified that the TYPE_PROXIMITY = 8. Than why in the log I get that the handle = 4 ??

Let's say this is a normal thing, how can I get the actual sensor type from that handle number? I cannot just convert this number to be the sensor type. i.e How can I know that the handle=4 means TYPE_PROXIMITY?

Thanks;

도움이 되었습니까?

해결책

AHAH!

There is a private method android.hardware.Sensor.getHandle() which returns the sensor handle number so I can make a map type to handle!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top