質問

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