Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Vibrate the system default pattern in Android?

I know about the Vibrate class and how to use it, but where can I get the system default vibration pattern to use? Or is there some kind of intent I can launch to get the system to vibrate its default vibration?

like image 878
Mohamed Hafez Avatar asked Sep 23 '13 17:09

Mohamed Hafez


Video Answer


1 Answers

Create a method that reproduce the default vibration and call it on every selection.

import android.os.Vibrator;

private void vibrate(){
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(1000);
    }

permission required in AndroidManifest.xml file:

<uses-permission android:name="android.permission.VIBRATE"/>
like image 92
Jorgesys Avatar answered Sep 24 '22 19:09

Jorgesys