How to enable automatic application launch in xiaomi programmatically

I would like to know if a help desk for any application can be provided by xiaomi? I have a service in my application that needs to constantly work in the background, in all devices it works fine, except Xiaomi, how can this be done programmatically?

+7
android
source share
2 answers

Works for xiaomi, oppo, vivo and oneplus phones.

try { Intent intent = new Intent(); String manufacturer = android.os.Build.MANUFACTURER; if ("xiaomi".equalsIgnoreCase(manufacturer)) { intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")); } else if ("oppo".equalsIgnoreCase(manufacturer)) { intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity")); } else if ("vivo".equalsIgnoreCase(manufacturer)) { intent.setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity")); } else if("oneplus".equalsIgnoreCase(manufacturer)) { intent.setComponent(new ComponentName("com.oneplus.security", "com.oneplus.security.chainlaunch.view.ChainLaunchAppListAct‌​ivity")); } List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (list.size() > 0) { context.startActivity(intent); } } catch (Exception e) { Crashlytics.logException(e); } 
+6
source share

you cannot do this from code until there is an api from xiaomi which will give you access to this function. I assume that the autorun manager is an application (with privileges from the system application, as part of the modified xiaomi os) is therefore not possible. On the other hand, if the device is implemented, you can actually disable the startup manager.

However, Whatsapp, facebook, and many other applications that do this may be due to the fact that they have Xiaomi bindings to be on the white list. But this is just an assumption.

+4
source share

All Articles