Skip to content

Commit

Permalink
Merge pull request #59 from chrisonline/master
Browse files Browse the repository at this point in the history
Added package component from a Galaxy S8 with Android 9
  • Loading branch information
judemanutd authored Mar 24, 2021
2 parents 03e4e41 + 81badb2 commit 3a29646
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 3a29646

Please sign in to comment.