3

I am building an android application where I am using some services. My services get close when application is close in some custom android OS like MI.

Then I figure out we have to push our application in white list of security autostart application.

I got some SOF link's where they are suggesting below answer.

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

This above code used to send user to that particular page.

Now I have to check if my application is disable so I can send user to this page and if it is enable then move to other screen. Is there any way to check this?

Hitesh Matnani
  • 309
  • 1
  • 5
  • 20

1 Answers1

0

There is no Android API to check if the the AutoStart is enabled or not. Though you can have your own logic in the App (may be you can use preference to set a Boolean for it) to check this. Also the above way to enabling the AutoStart might not work always. Please have a look here

Akki
  • 775
  • 8
  • 19