Improve app autostart
Этот коммит содержится в:
@@ -38,7 +38,8 @@
|
||||
|
||||
<activity-alias
|
||||
android:name=".Launcher"
|
||||
android:targetActivity=".MainActivity">
|
||||
android:targetActivity=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -52,7 +53,8 @@
|
||||
|
||||
<activity
|
||||
android:name=".ShortcutActivity"
|
||||
android:label="@string/menu_shortcuts">
|
||||
android:label="@string/menu_shortcuts"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
@@ -66,7 +68,9 @@
|
||||
<service
|
||||
android:name=".TrackingService$HideNotificationService" />
|
||||
|
||||
<receiver android:name=".AutostartReceiver">
|
||||
<receiver
|
||||
android:name=".AutostartReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.PowerManager
|
||||
import android.provider.Settings
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.judemanutd.autostarter.AutoStartPermissionHelper
|
||||
|
||||
class BatteryOptimizationHelper {
|
||||
|
||||
@@ -80,11 +81,15 @@ class BatteryOptimizationHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!sharedPreferences.getBoolean(KEY_AUTOSTART_REQUESTED, false)) {
|
||||
sharedPreferences.edit().putBoolean(KEY_AUTOSTART_REQUESTED, true).apply()
|
||||
AutoStartPermissionHelper.getInstance().getAutoStartPermission(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KEY_EXCEPTION_REQUESTED = "exceptionRequested"
|
||||
private const val KEY_AUTOSTART_REQUESTED = "autostartRequested"
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user