Currently using powerManager.isIgnoringBatteryOptimizations(getPackageName())
for devices running api >= 23.
And requesting user to allow my app to be not optimised by using
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + getPackageName()));
This works on most of the devices, but on Oneplus devices even after user allowing it to be not optimised, I see no effect, my application is still optimised and I miss SMS_RECEIVED
broadcast.
Oneplus device with Oxygen OS 5.0.1 and Android OS 8.0.0