How to programmatically enable Autostart option for my app in MI 4i security APP?

Chirag Kheni picture Chirag Kheni · Aug 31, 2015 · Viewed 7k times · Source

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.

Answer

Mohit Mathur picture Mohit Mathur · Jan 17, 2017

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);
        }