开发者

Will a general accelerometer based android code work on htc mobiles? (HTC Desire to be specific)

开发者 https://www.devze.com 2023-01-20 16:56 出处:网络
I am migrating from Symbian to Android. For symbian based nokia mobile phones, the support for accelerometer sensing using java is by the Mobile Sensor API (JSR 256) which is provided in the technical

I am migrating from Symbian to Android. For symbian based nokia mobile phones, the support for accelerometer sensing using java is by the Mobile Sensor API (JSR 256) which is provided in the technical specifications of every nokia mobile phone that supports it.

However, for Android based "HTC Desire" mobile phone, I am not sure whether the HTC mobile has to provide for sensor APIs or whether the mobile's support of Android 2.2 is enough to get java code to access the mobile's accelerometer data. Please advise.

To be more specific, I was thinking of writing a java application that uses the accelerometer to act like a wireless mouse for a PC. And then add some extra functionality to it to serve as a general purpose pc controller that takes the z axis into consideration apart from the standard x-y axes the mouse uses. For this, should HTC provide for 开发者_JS百科any APIs to access accelerometer data? If so, what APIs? or is HTC's Android 2.2 enough to achieve this feat? Please advise. Thank you in advance.


Android provides an API to access the accelerometers of all Android devices (see here: http://developer.android.com/reference/android/hardware/SensorManager.html), and there are lots of examples on how to use it. This has nothing to do with HTC.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号