diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/NotificationService.java | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index d6787301a..47cdc4f3b 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -143,8 +143,12 @@ public class NotificationService { final boolean isScreenOn = mXmppConnectionService.isInteractive(); if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) { Log.d(Config.LOGTAG,message.getConversation().getAccount().getJid().toBareJid()+": suppressing notification because conversation is open"); + mXmppConnectionService.vibrate(); return; } + if (this.mIsInForeground && isScreenOn) { + mXmppConnectionService.vibrate(); + } synchronized (notifications) { pushToStack(message); final Account account = message.getConversation().getAccount(); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 1d80c066f..df52a3b27 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -23,6 +23,7 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.SystemClock; +import android.os.Vibrator; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.security.KeyChain; @@ -2859,6 +2860,12 @@ public class XmppConnectionService extends Service { return count; } + public void vibrate() { + Log.d(Config.LOGTAG,"Notification: short vibrate"); + Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); + vibrator.vibrate(100); + } + public void showErrorToastInUi(int resId) { if (mOnShowErrorToast != null) { |