using the vibrate(long[] pattern, int repeat)

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

// Start time delay 
// Vibrate for 500 milliseconds 
// Sleep for 1000 milliseconds 
long[] pattern = {0, 500, 1000};

// 0 meaning is repeat indefinitely 
vibrator.vibrate(pattern, 0);