How do I make K-9 Mail work with OpenKeychain on Xiaomi's MIUI?


I had a hard time setting up K9 mail with openkeychain on MIUI android ROM.

I was able to go to the “general settings” and select the openkeychain app as the default application for encryption. The problem was when I selected a specific encryption/decryption key for my email account I clicked several times in the option “My key” but nothing happened.

Turns out it is necessary to disable battery optimizations for openkeychain and allow to run it on the background. If you have MIUI, do the following to solve this problem:

  1. Go to the “Security” application provided by MIUI.
  2. Select the option “Manage apps”
  3. Search for openkeychain and click on it.
  4. Select “Battery saver”
  5. Select the option “No restrictions”

If it still does not work do the following:

  1. In the openkeychain manager app menu, select “Other permissions”
  2. Select both “Display pop-up windows while running in the background” & “Permanent notification”
  3. Go back to the main menu again and select “App permissions”
  4. Allow the storage permission.

If it still does not work, do the above steps for the K9 mail application as well.


ths a lot works also on redmi note 8 pro

Thanks OblackatO for the tutorial.
This also works with
Android 11 on Xiaomi Mi 10T Lite with MiUi 12.0.1