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?
The Vibrator
class does just that. It's hasVibrator()
method returns a boolean indicating if vibrating is supported.
hasVibrator()
method.String vs = Context.VIBRATOR_SERVICE;
Vibrator mVibrator = (Vibrator)getSystemService(vs);
boolean isVibrator = mVibrator.hasVibrator();