Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added package component from a Galaxy S8 with Android 9 #59

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.judemanutd.autostarter

import android.content.ActivityNotFoundException
import android.content.ComponentName
import android.content.Context
import android.content.Intent
Expand Down Expand Up @@ -82,6 +83,7 @@ class AutoStartPermissionHelper private constructor() {
private val BRAND_SAMSUNG = "samsung"
private val PACKAGE_SAMSUNG_MAIN = "com.samsung.android.lool"
private val PACKAGE_SAMSUNG_COMPONENT = "com.samsung.android.sm.ui.battery.BatteryActivity"
private val PACKAGE_SAMSUNG_COMPONENT_2 = "com.samsung.android.sm.battery.ui.BatteryActivity"

/***
* One plus
Expand Down Expand Up @@ -291,6 +293,14 @@ class AutoStartPermissionHelper private constructor() {
if (isPackageExists(context, PACKAGE_SAMSUNG_MAIN)) {
try {
startIntent(context, PACKAGE_SAMSUNG_MAIN, PACKAGE_SAMSUNG_COMPONENT)
} catch (a: ActivityNotFoundException) {
// Try with the another package component
try {
startIntent(context, PACKAGE_SAMSUNG_MAIN, PACKAGE_SAMSUNG_COMPONENT_2)
} catch (e: Exception) {
e.printStackTrace()
return false
}
} catch (e: Exception) {
e.printStackTrace()
return false
Expand Down