Skip to content

Instantly share code, notes, and snippets.

@nieldeokar
Last active November 13, 2017 11:37
Show Gist options
  • Save nieldeokar/00676ad258113c92a7efcc022028cac2 to your computer and use it in GitHub Desktop.
Save nieldeokar/00676ad258113c92a7efcc022028cac2 to your computer and use it in GitHub Desktop.
This would create a custom vibrate pattern.
private void customVibratePatternNoRepeat() {
// 0 : Start without a delay
// 400 : Vibrate for 400 milliseconds
// 200 : Pause for 200 milliseconds
// 400 : Vibrate for 400 milliseconds
long[] mVibratePattern = new long[]{0, 400, 200, 400};
// -1 : Do not repeat this pattern
// pass 0 if you want to repeat this pattern from 0th index
vibrator.vibrate(mVibratePattern, -1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment