Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 416
Chirag Kheni Avatar asked Aug 31 '15 13:08

Chirag Kheni


People also ask

How do I get Miui security app auto start permission programmatically?

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!

How do I enable autostart permission in Android programmatically?

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 .

What does Auto Start mean on xiaomi?

In general, if background services are stopped without any notification on the Android devices, they should be automatically started again by default.


1 Answers

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);
        }
like image 150
Mohit Mathur Avatar answered Sep 30 '22 21:09

Mohit Mathur