After release, an Android app raises its 'machine_done' NotificationChannel from IMPORTANCE_DEFAULT to IMPORTANCE_HIGH in code, yet existing users get no heads-up alerts; why, and what do you do?
answer
- who owns a channel after creation
- what re-registering may still change
- importance may only go down
- deleting and re-creating the same ID
- a new ID, or the settings deep link
basics
~20 sOnce a channel exists the user owns its behaviour: re-registering it can only lower its importance, never raise it. For heads-up alerts, create a new channel ID at IMPORTANCE_HIGH and delete the old one, or link users to its settings.
solid answer
~40 s`createNotificationChannel()` on an existing ID updates only the name, the description, the group if it has none yet, and the importance when the new value is *lower* and the user has not touched the channel; every other field is ignored. So `IMPORTANCE_HIGH` in the new build never reaches existing installs, while fresh installs get it, which is why only some users see heads-ups. Deleting and re-creating `machine_done` does not help: a channel re-created with a deleted ID comes back with its old settings. The fix is a new ID such as `machine_done_v2` at `IMPORTANCE_HIGH`, posted to from then on, with `deleteNotificationChannel("machine_done")`, unless the user had turned the old one down, which I respect. For users who should decide themselves, a button opens `Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS`.
code
kotlin · 15 linesfun migrateMachineDoneChannel(context: Context) {
val manager = NotificationManagerCompat.from(context)
val old = manager.getNotificationChannelCompat("machine_done")
val importance = when {
old == null -> NotificationManagerCompat.IMPORTANCE_HIGH
old.importance < NotificationManagerCompat.IMPORTANCE_DEFAULT -> old.importance
else -> NotificationManagerCompat.IMPORTANCE_HIGH
}
manager.createNotificationChannel(
NotificationChannelCompat.Builder("machine_done_v2", importance)
.setName(context.getString(R.string.channel_machine_done))
.build()
)
if (old != null) manager.deleteNotificationChannel("machine_done")
}go deeper
Remember that once a channel is created its importance and sound belong to the user, so changing them in code later does not reach existing installs.
Explain exactly what re-registering an existing channel can still change, and why fresh installs and upgraded installs behave differently.
Diagnose the new-versus-old install split, avoid the delete-and-recreate trap, migrate to a new ID while carrying over user choices, and offer the channel settings deep link.
Make channel design a reviewed, versioned contract, since every mistake becomes a migration that users can see in their settings.
## Why the code change does nothing From **Android 8.0 (API 26)**, a notification's interruption level comes from its channel's **importance**, not from the notification. The channels guide is blunt about ownership: after you create a channel you cannot change its notification behaviours; the user has complete control. The platform javadoc of `createNotificationChannel()` spells out what re-registering an existing channel can still do: | Field on an existing channel | Effect of calling `createNotificationChannel()` again | |---|---| | Name and description | Updated (meant for a locale change or a user rename) | | Group | Set only if the channel does not already belong to a group | | Importance | Changed only if the new value is **lower** and the user has not altered any setting on the channel | | Sound, vibration, lights, badge, everything else | Ignored | So on an existing install `IMPORTANCE_DEFAULT` stays, while a fresh install creates the channel at `IMPORTANCE_HIGH`. That split, where new users get heads-up alerts and long-time users do not, is the classic symptom. ## The trap: delete and re-create with the same ID The obvious workaround looks like this: `deleteNotificationChannel("machine_done")`, then `createNotificationChannel()` with the same ID and `IMPORTANCE_HIGH`. The javadoc of `deleteNotificationChannel()` says that creating a channel with the same ID **un-deletes** it **with all the settings it had before**. Nothing changes, and the system settings screen now shows a deleted-channel count, which the guide describes as a spam-prevention measure users can see. ## What works 1. **Migrate to a new channel ID.** Register `machine_done_v2` at `IMPORTANCE_HIGH`, switch every builder to it, and delete `machine_done` so users do not see two entries. 2. **Respect a user who already decided.** Before migrating, read the old channel with `NotificationManagerCompat.getNotificationChannelCompat("machine_done")` and its `getImportance()`. If the user set it to `IMPORTANCE_NONE` or lowered it, carry that choice over rather than overriding it with a louder default. 3. **Or let the user raise it.** Read the importance, and when it is below what the feature needs, offer a button that starts `Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS` with `Settings.EXTRA_APP_PACKAGE` and `Settings.EXTRA_CHANNEL_ID`. Even at `IMPORTANCE_HIGH` the guide notes that the system does not guarantee the alert behaviour: it may adjust it, and the user can change it at any time. ## What this means before release - Treat a channel's ID, importance, sound and vibration as **frozen at first install**. Getting them right is a design review item, not a later tweak. - Version channel IDs from the start (`machine_done_v1`) so a migration reads naturally. - Group membership is also sticky: once a channel belongs to a `NotificationChannelGroup`, re-registering it with another group does nothing. - Test the upgrade path by installing the new build over the old one. Reinstalling or clearing app data clears the channels on a development device, so a fresh-install test hides the problem completely. ## Confirming the diagnosis 1. Log or report the channel's current importance from `getNotificationChannelCompat("machine_done")` on a sample of installs; upgraded installs whose users never edited the channel still show `IMPORTANCE_DEFAULT` (3), while fresh ones show `IMPORTANCE_HIGH` (4). 2. Reproduce it locally: install the old build, open the app so the channel is created, then install the new build over it without clearing data. 3. Rule out app-wide blocking with `areNotificationsEnabled()` before blaming the channel. ## Reading what the user chose - `getNotificationChannelCompat(id)` returns the channel as it currently is, including the user's changes, or `null` below API 26. - `getImportance()`, `getSound()` and `getVibrationPattern()` on it let the app adapt, for example by showing an in-app banner when finish alerts are silenced. - `NotificationManagerCompat.areNotificationsEnabled()` covers the case where the whole app is blocked rather than one channel. ## Common wrong explanations - "The device is in Do Not Disturb": possible for one user, but it does not explain a split between new and old installs. - "Use `setPriority(PRIORITY_HIGH)` on the builder": priority is ignored from Android 8.0. - "Delete and re-create the channel at launch": that restores the old settings. - "The new importance only applies after a reboot": nothing about the stored channel changes, so no restart helps; only a new ID or the user's own edit does. - "Heads-up needs `setCategory()`": a category is a ranking and filtering hint, while peeking comes from `IMPORTANCE_HIGH` on the channel.
- The same alert also uses setFullScreenIntent, but the full-screen activity never launches; how does the channel play into it?A full-screen intent launches only when the notification is posted to a channel at `IMPORTANCE_HIGH` or higher, so a `DEFAULT` channel rules it out. From Android 14 (API 34) the app may also lack `USE_FULL_SCREEN_INTENT`, which `NotificationManagerCompat.canUseFullScreenIntent()` reports; then the system shows the notification as an expanded heads-up on the lock screen instead. The platform reserves full-screen intents for urgent cases such as an incoming call or an alarm the user set, so a 'washer done' alert stays a heads-up.
- Why does the settings screen show a count of deleted channels, and what does that mean for migrations?The guide describes the count as spam prevention: users can see that an app keeps deleting channels. A one-off move to a versioned ID is fine, but deleting and re-creating channels on every release to reset user choices is visible to the user and, for a re-used ID, restores the old settings anyway.
A channel is like a thermostat you installed in a tenant's flat: on move-in day you choose the setting, after that only the tenant turns it up, and you may at most turn it down if they never touched it.
- createNotificationChannel overwrites an existing channel's importance
- Deleting and re-creating the same channel ID resets it to the new settings
- setPriority(PRIORITY_HIGH) fixes heads-up on Android 8 and later
- Migrating to a new ID should ignore what the user set on the old channel
- An app can lower importance even after the user edited the channel
Assumes API 37 and androidx.core 1.19.1; channel importance governs alerting from Android 8.0 (API 26), and the rules for re-registering an existing channel are those of NotificationManager.createNotificationChannel at API 37.