I want to create an android app for blind people, so I don't want vibrations from outside my app, like notifications or other apps, otherwise those would change the pattern. How can I do it programmatically using Java?
As SteelToe said:
Just set the ringer to silence when your app is running and then turn the ringer back on to vibrate right before your app vibrates and then after it vibrates put it back on scilence
So you could use code like:
function vibrateOn(){
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_ON);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_ON);
}
function vibrateOff(){
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_OFF);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_OFF);
}