How can I change the vibration pattern during an incoming call on my Android phone?

I am trying to change the vibration pattern of my phone on receiving an incoming call. I am able to vibrate my device in case of no incoming call.

Vibrator v = (Vibrator) this.context.getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 500 milliseconds
v.vibrate(500);

But, when I receive an incoming call, my app unexpectedly stops.

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by bschumm
12 minutes ago
Last post by kortiz
3 hours ago
Last post by rosemarie71
1 hour ago
Last post by macejkovic.oliver
3 hours ago
Last post by mathew27
54 minutes ago
Last post by btoy
28 minutes ago
Last post by maddison.mills
13 minutes ago