Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
miskatonic
Posts: 83
Registered: ‎02-17-2009
Accepted Solution

Is it possible to check if a device has accelerometer via code?

Hi,

 

Is it possible to check if a device has accelerometer via code? If yes... how?

 

Thanks

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Carrier: Verizon

Re: Is it possible to check if a device has accelerometer via code?

If you are coding using 4.7 or higher you can use AccelerometerSensor.isSupported(). If you are using 4.6 or lower then I don't think there is a way.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009

Re: Is it possible to check if a device has accelerometer via code?

If the AccelerometerSensor class is missing for 4.6 or less, you won't be able to build it on 4.6 or less, so the point's moot.

Please use plain text.
Developer
miskatonic
Posts: 83
Registered: ‎02-17-2009

Re: Is it possible to check if a device has accelerometer via code?

Thanks, that was enough

 

I was building using 4.7 to work for 5.0 devices.

Please use plain text.