For check screenshot and detail, click here
Please give related suggession or code for how to add automatic enable auto start for my app , please check here attached screen shot thanks in advance.
You need to give permissions in the in build security application for xiaomi. 1. open the security app 2. go to permissions 3. go to auto start 4. enable the applications that you want to keep running in the background!
There's no way to find out whether the Auto-start option is enabled or not. You can manually check under Security permissions => Autostart => Enable Autostart .
In general, if background services are stopped without any notification on the Android devices, they should be automatically started again by default.
Try this...it's working for me. It will open the screen to enable autostart.
String manufacturer = "xiaomi";
if(manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
//this will open auto start screen where user can enable permission for your app
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
startActivity(intent);
}
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