Sunday, June 20, 2010

Vibration in Android

The code snippet for vibrating android phone is,

 
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(2000);


Here 2000 is 2000 milliseconds, the phone will vibrate. And of course you can't test this in emulator, you need a real device to test this.

No comments:

Post a Comment

Androidians