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?
Turning battery saver on does not seem to have any noticable impact on performance at least. To test if it actually saves extra battery I let the battery drain from 100% to 8% with almost same usage profile.
There's no harm in using Battery Saver mode, but you do lose features while it's activated, including GPS and background syncing.
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) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With