Java tutorial
//package com.java2s; import android.content.Context; import android.os.Vibrator; public class Main { public static void vibrateDevice(Context context, long time) { if (context == null) return; if (time < 100) time = 100; if (time > 2000) time = 200; Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(time); } }