How to enable auto start for my app in Xiaomi programmatically

后端 未结 7 1270
情话喂你
情话喂你 2020-12-01 01:20

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

7条回答
  •  生来不讨喜
    2020-12-01 02:02

    You may try this:

    if ("xiaomi".equalsIgnoreCase(str)) 
    {
     intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
                        } 
    else if ("oppo".equalsIgnoreCase(str)) 
    {
     intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"));
                        } 
    else if ("vivo".equalsIgnoreCase(str)) 
    {
      intent.setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.MainGuideActivity."));
     }
    

提交回复
热议问题