I have a service in my app which needs to be running in the background all the time. On all devices, it\'s working fine except Xiaomi. I have read somewhere that we need to
you can do it by following:
if (manufactXiaomi.equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
if (!session.getVisibilityOfAutoStartDialog()) {Intent intent = new Intent();
intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
startActivity(intent);}}
if you want to keep running your service is the background you need to change some setting of your device Check This
might above code works for you