Vibrator in android

How to create a vibrator object and call the vibration function? http://developer.android.com/reference/android/os/Vibrator.html does not provide much information on how to create an object (without public constructors)

+4
source share
2 answers

I think you are looking for:

Vibrator bzzz = (Vibrator) getSystemService(VIBRATOR_SERVICE); 

See the docs .

+9
source

You need to create an object, then call the object.vibrate whith period function in milliseconds

 Vibrator v = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); // To vibrate for 1 second v.vibrate(1000); 
0
source

All Articles