I am working on VoIP calling applications and calls are getting missed which are sent over FCM when battery saver is on on MIUI. This is happening very frequently.
I want user to open Battery saver activity
for my own app and give no restriction for that app in battery saver.
For example: this is a the battery saver page for whatsApp.
I want to open this page directly for my app from my app.
I have managed to enable autostart in the shown way. How to check MIUI autostart permission programmatically?
After checking logs for the MiFit app, I finally figured it out!
It took almost 3 days of continuous research. Pheww, here is the code.
try {
Intent intent = new Intent();
intent.setComponent(ComponentName("com.miui.powerkeeper", "com.miui.powerkeeper.ui.HiddenAppsConfigActivity"));
intent.putExtra("package_name", getPackageName());
intent.putExtra("package_label", getText(R.string.app_name));
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
}