OxygenOS is often described as one of the best skins for Android on the market. It's fast, clean, and has a ton of useful features that appeal to just about everyone. However, it's also faced a significant issue for the longest time — overly aggressive battery optimizations that frequently kill background apps, including Gmail services.
It's annoying when you continuously miss your email notifications because OxygenOS keeps killing off the required services. Even disabling battery optimization isn't guaranteed to work, so it's an ongoing issue that still hasn't been solved. Luckily, there's a Magisk module that should fix the Gmail woes you might be having. By developer David Sn, the aptly named OxygenOS Gmail Battery Fix replaces an XML file in the app to override the problematic battery optimizations.
Open up the Magisk Manager app, tap the menu icon on the left, then head to "Downloads." Tap the search icon, then type in the term "gmail" to find the OxygenOS Gmail Battery Fix module.
Tap the download arrow once, then the "Install" option from there. Grant Magisk Manager any permissions requested by tapping "Allow," then the installation process will begin.
The module will install within seconds, so once it's finished, tap the "Reboot" button at the bottom to restart your phone and enable the module.
Once back from the reboot, you just need to wait for any Gmail notification to come in. It should work just fine now since the module completely disables the overbearing battery optimizations for Gmail. Even when your screen is off, you should get email notifications almost instantaneously. However, future system updates could potentially break the module, so be aware of that if you start missing notifications once again.
Gmail is not the only app that has trouble with background services on OxygenOS, of course. The issue is bad enough that someone had to create a module to fix it, so that speaks volumes. With Android 10 "Q" right around the corner, OnePlus has a chance to right this wrong by fixing it on the system level.
The module is working for me using the OnePlus 6T and 7 Pro just the same, but it may not work for everyone. During my testing, my Gmail notifications went through every single time without issue. The notifications were generally instant, though some took as long as two minutes to come through. Still tons better than it was. Hopefully, it all works for you until OnePlus issues an official fix for their OxygenOS.