Somehow tricky question. I am working with one app through which user can set incoming call custom ringtone and different vibration level for different contacts.
I have stuck with vibration level setting. We can set vibration level using,
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// 1. Vibrate for 1000 milliseconds
long milliseconds = 1000;
v.vibrate(milliseconds);
// 2. Vibrate in a Pattern with 500ms on, 500ms off for 5 times
long[] pattern = { 500, 300 };
v.vibrate(pattern, 5);
This is what about vibrate my phone. But I want to set vibration level of incoming call. User can set from different predefined vibration settings.
Using this code I can set Vibration ON - OFF. But dont know how to set level of vibration.
String VIBRATE_IN_SILENT_SETTING_NAME = "vibrate_in_silent";
Settings.System.putInt(getContentResolver(), VIBRATE_IN_SILENT_SETTING_NAME, 1);
I hope that someone could give some advice on this issue. suggestions are welcomed.