forked from jens/Automation
vibrate for calls
This commit is contained in:
parent
e3598cc475
commit
969937f8a0
@ -5,6 +5,7 @@ import android.content.Context;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -490,10 +491,19 @@ public class Profile implements Comparable<Profile>
|
|||||||
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
||||||
|
|
||||||
if(changeVibrateWhenRinging)
|
if(changeVibrateWhenRinging)
|
||||||
|
{
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
{
|
||||||
|
android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (vibrateWhenRinging)
|
if (vibrateWhenRinging)
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
||||||
else
|
else
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(changeNotificationRingtone)
|
if(changeNotificationRingtone)
|
||||||
if(notificationRingtone != null)
|
if(notificationRingtone != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user