-
-
Save erlangparasu/8272d0186d71c657a4716a634ea58af0 to your computer and use it in GitHub Desktop.
used to get Autostart option for Alarm Manager in Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addAutoStartupswitch() { | |
try { | |
Intent intent = new Intent(); | |
String manufacturer = android.os.Build.MANUFACTURER .toLowerCase(); | |
String model= Build.MODEL; | |
Log.d("DeviceModel",model.toString()); | |
switch (manufacturer){ | |
case "xiaomi": | |
intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")); | |
break; | |
case "oppo": | |
intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity")); | |
break; | |
case "vivo": | |
intent.setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity")); | |
break; | |
case "Letv": | |
intent.setComponent(new ComponentName("com.letv.android.letvsafe", "com.letv.android.letvsafe.AutobootManageActivity")); | |
break; | |
case "Honor": | |
intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity")); | |
break; | |
case "oneplus": | |
intent.setComponent(new ComponentName("com.oneplus.security", "com.oneplus.security.chainlaunch.view.ChainLaunchAppListActivity")); | |
break; | |
} | |
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); | |
if (list.size() > 0) { | |
startActivity(intent); | |
} | |
} catch (Exception e) { | |
Log.e("exc" , String.valueOf(e)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment