Sunday 15 March 2015

How do I detect if an Android device has built-in haptic capacities? -



How do I detect if an Android device has built-in haptic capacities? -

i have, in application settings, next choices key feedback:

none, sound, haptic

if, , if, device has built-in haptic capacities. otherwise, options should be:

none, sound

how do this? way i'm not asking whether user has enabled or disabled haptic in his/her device, whether his/her device has haptic capabilities.

i'm new android i'm guessing older/cheaper devices not have haptic capabilities.

note: application targets android api level >= 8

try:

vibrator v = (vibrator) getsystemservice(context.vibrator_service); if (v != null && v.hasvibrator()) { // add together haptic feedback alternative }

android

No comments:

Post a Comment