Skip to content

Instantly share code, notes, and snippets.

@balsikandar
Created January 21, 2021 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balsikandar/dc1e99af9c4b369f94ff9fe50307891b to your computer and use it in GitHub Desktop.
Save balsikandar/dc1e99af9c4b369f94ff9fe50307891b to your computer and use it in GitHub Desktop.
try {
val intent = Intent()
val manufacturer = Build.MANUFACTURER
if ("xiaomi".equals(manufacturer, ignoreCase = true)) {
intent.component = ComponentName(
"com.miui.securitycenter",
"com.miui.permcenter.autostart.AutoStartManagementActivity"
)
} else if ("oppo".equals(manufacturer, ignoreCase = true)) {
intent.component = ComponentName(
"com.coloros.safecenter",
"com.coloros.safecenter.permission.startup.StartupAppListActivity"
)
} else if ("vivo".equals(manufacturer, ignoreCase = true)) {
intent.component = ComponentName(
"com.vivo.permissionmanager",
"com.vivo.permissionmanager.activity.BgStartUpManagerActivity"
)
}
val list: List<ResolveInfo> = packageManager
.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
if (list.isNotEmpty()) {
startActivity(intent)
}
} catch (e: Exception) {
Crashlytics.logException(e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment