I am working on an app where I need to ask user for the autostart permission and for that I am opening the Autostart permissions settings page for the user to turn on the permission for our app using following code for few Manufacturers:
Intent autostartIntent = new Intent();
if ("xiaomi".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
autostartIntent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
startActivity(autostartIntent);
} else if ("oppo".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
autostartIntent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"));
startActivity(autostartIntent);
} else if ("vivo".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
autostartIntent.setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity"));
startActivity(autostartIntent);
} else if ("huawei".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
autostartIntent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity"));
startActivity(autostartIntent);
}
Moreover, when I am trying to redirect user to the following devices, I am facing following difficulties:
On RealMe 2 Pro, for which the manufacturer is Oppo, the system is unable to start the AutoStart Permissions Activity.
On Moto and Nokia devices, I am not able to get the path of AutoStart Activity, so that I can redirect user to that page directly.