How can I find out if a device has a vibrator?

后端 未结 4 1085
臣服心动
臣服心动 2021-01-03 17:58

I have a device of which I don\'t know if it has a vibrator.

Is there a way to query for the availability of the vibrator?

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 18:26

    You need to support (at least) Android 3.0 (11 HoneyComb) before you can use hasVibrator().

    Oddly, you can use vibrate() itself on any/all versions.

    So the REAL question is: How do v1 - v10 detect if the device has vibrator? (Or will nothing bad happen if you try to vibrate a device without a vibrator?)

提交回复
热议问题