Skip to content

No notification sound in vibrate mode despite priority 10 / high-importance channel (missing USAGE_ALARM audio attributes) #452

Description

@DamienAuv

Environment

  • Device: Samsung Galaxy A54
  • Android version: 16 (One UI)
  • Gotify Android app version: 2.10.1
  • Gotify server version: 2.6.3
  • WebSocket connection: OK, no errors
  • Battery optimization: Disabled for Gotify (not optimized)

Description

Notifications are received reliably (stable connection, no errors in logs). However, when the phone is in vibrate mode, messages sent with priority: 10 produce only vibration, no sound — even though:

  • The app's per-priority notification channels exist and the high-importance channel is used.
  • The high-importance channel and DND exceptions have been configured in Android system settings.
  • All available Android permissions / DND exceptions have been granted.

This is being used for on-call (astreinte) alerting, where an audible sound that overrides vibrate-only mode is critical.

Steps to reproduce

  1. Confirm Gotify's priority-based notification channels exist (high / default importance).
  2. Set the phone to vibrate mode (not silent, not DND).
  3. Send a Gotify message with "priority": 10.
  4. Notification and vibration occur, but no sound is played.

Expected behavior

A priority: 10 message should be able to play sound even in vibrate mode, consistent with Android's alarm audio behavior, so it can be used for on-call alerting.

Actual behavior

No sound is played regardless of priority; only vibration occurs.

Logcat evidence

Captured on the device at the moment of a priority: 10 message (ringer mode = vibrate):

08-07 10:25:13.958  7132  7191 I NotificationManager: com.github.gotify: notify(-5, null,
Notification(channel=8::gotify_messages_high_importance shortcut=null contentView=null vibrate=null sound=null
defaults=0 flags=AUTO_CANCEL|GROUP_SUMMARY color=0xff3867d6 groupKey=GOTIFY_GROUP_MESSAGES vis=PRIVATE ...)) as user

08-07 10:25:14.087  7132  7191 I NotificationManager: com.github.gotify: notify(581, null,
Notification(channel=8::gotify_messages_high_importance shortcut=null contentView=null vibrate=null sound=null
defaults=0 flags=SHOW_LIGHTS|AUTO_CANCEL color=0xff3867d6 groupKey=GOTIFY_GROUP_MESSAGES vis=PRIVATE ...)) as user

08-07 10:25:14.879  1554 13999 D VibratorManagerService: converted usage = NOTIFICATION(49)
08-07 10:25:14.879  1554 13999 D VibratorManagerService: vibrate - uid: 1000, opPkg: android, effect: ...,
  attrs: VibrationAttributes{mUsage=NOTIFICATION, mAudioUsage= USAGE_UNKNOWN, ...},
  reason: Notification (com.github.gotify 10249)
08-07 10:25:15.995  1554  1804 D VibratorManagerService: Vibration for uid=1000 ... ended with status FINISHED

Two things stand out:

  1. Routing is correct — the priority: 10 message is posted on gotify_messages_high_importance, so priority → channel mapping works.
  2. The only system reaction is a vibration with mUsage=NOTIFICATION. There is no audio playback event anywhere in the log around the notification (no AudioManager / stream / ringtone activity). The vibration is emitted with NOTIFICATION usage, not ALARM.

Root cause hypothesis

Because the channel's audio is configured with a notification usage rather than an alarm usage, Android suppresses the sound when the ringer is in vibrate mode. This is not something a user can fix in system settings — the AudioAttributes usage of a NotificationChannel is set programmatically by the app when the channel is created and is immutable afterwards. So even with a custom sound set on the channel, vibrate mode silences it.

Feature request

Add an option (per priority level, or at least for priority ≥ 8/10) to route high-priority messages through an alarm-style channel, so they sound even in vibrate mode. Concretely, create a dedicated NotificationChannel whose sound is set with:

val audioAttributes = AudioAttributes.Builder()
    .setUsage(AudioAttributes.USAGE_ALARM)          // key change: ALARM instead of USAGE_NOTIFICATION*
    .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
    .build()

val channel = NotificationChannel(
    "gotify_messages_alarm",
    "Alarm (priority 10)",
    NotificationManager.IMPORTANCE_HIGH
).apply {
    setSound(alarmSoundUri, audioAttributes)
    enableVibration(true)
}

Optionally combine with a full-screen intent for truly critical alerts. This is the approach used by apps whose alerts must break through silent/vibrate (e.g. Home Assistant's alarm_stream channel, and on-call tools like PagerDuty/Opsgenie).

Additional context

Happy to provide full logcat output or further device diagnostics if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions