Skip to content

Fix delayed notifications on a Xiaomi phone

Christophe TREMBLAY-GUILLOUX
Christophe TREMBLAY-GUILLOUXLinux systems engineer

On a Xiaomi phone running HyperOS, notifications from some applications arrive several minutes late, sometimes only when the screen is unlocked. The system keeps a whitelist of applications allowed to receive notifications without delay. That list is prefilled with applications distributed in China, and messaging apps installed from another country are not in it.

This is also the case for Google Play services (com.google.android.gms), which relay the push notifications of most messaging apps. When they are installed afterwards, they are not added to that whitelist: installing them does not change it.

  • A Xiaomi phone running HyperOS.
  • A Linux workstation and a USB cable.
  • Root rights on the workstation to install one package.

The screenshots in this note come from a phone whose interface is in English, running Xiaomi HyperOS 3.0.307.0. If your phone uses another language, the labels quoted here are the ones to translate.

Swipe down from the top of the screen to open the control centre, then tap the settings shortcut: the round button marked with a hexagonal nut, at the right end of the third row of shortcuts.

HyperOS control centre, with the settings shortcut at the right of the third row

In Settings, tap My device, the second row of the first block.

HyperOS Settings screen, with the My device row under the Xiaomi account

On the page showing Xiaomi HyperOS and its version number, tap the OS version row seven times in a row. A message confirms the activation, or states that developer mode is already active, as on the screenshot below.

Xiaomi HyperOS page with the version number and the message stating that developer mode is already active

Expected result: a message confirms that developer mode is enabled.

Go back to Settings and scroll down to the last row, Additional settings.

Settings screen scrolled down to the Additional settings row

On that page, the Developer options row sits under the accounts block.

Additional settings page, with the Developer options row

Turn on the USB debugging switch, on the first row.

Developer options page, with the USB debugging switch turned on

On the phone used for this note, the USB debugging (Security settings) switch is turned on as well. If the write command in step 6 fails, try turning it on.

Then connect the phone to the workstation. The phone displays an authorisation request for the workstation key: accept it, ticking the option that makes it permanent if you plan to do this again later.

Expected result: the phone displays the notification stating that USB debugging is active.

On a Debian or Ubuntu based distribution, a single package is enough:

bash
apt install adb

Expected result: the adb version command answers.

bash
adb devices
List of devices attached
xxxxxxxx device

The serial number is masked here.

If the second column reads unauthorized, the authorisation was not accepted on the phone. If it reads offline, unplug and plug the cable back in.

Expected result: the phone is listed with the device status.

bash
adb shell settings get system MILLET_NO_RESTRICT_APP
com.whatsapp, org.thoughtcrime.securesms, [...], org.telegram.messenger

Select that line in your terminal and paste it into a text editor, so that you can add the missing application to it.

6. Add the missing application to the list

Section titled “6. Add the missing application to the list”

The following command replaces the whole list: you therefore have to write the original list again, then add just the missing application (com.google.android.gms) at the end of it.

bash
adb shell settings put system MILLET_NO_RESTRICT_APP "com.whatsapp, org.thoughtcrime.securesms, [...], org.telegram.messenger, com.google.android.gms"

Read the list again:

bash
adb shell settings get system MILLET_NO_RESTRICT_APP
com.whatsapp, org.thoughtcrime.securesms, [...], org.telegram.messenger, com.google.android.gms

Expected result: the notification arrives without waiting for the screen to be unlocked.