Improve app autostart
Этот коммит содержится в:
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'org.traccar.client'
|
||||
buildConfigField 'boolean', 'HIDDEN_APP', 'false'
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionCode 73
|
||||
versionName '6.12'
|
||||
multiDexEnabled true
|
||||
@@ -47,20 +47,21 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.android.material:material:1.5.0-alpha02'
|
||||
implementation 'com.google.android.material:material:1.5.0-alpha04'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||
implementation 'androidx.test:core-ktx:1.4.0'
|
||||
implementation "androidx.core:core-ktx:1.6.0"
|
||||
implementation 'androidx.core:core-ktx:1.6.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.github.judemanutd:autostarter:1.1.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.1'
|
||||
testImplementation 'org.robolectric:robolectric:4.6.1'
|
||||
googleImplementation platform('com.google.firebase:firebase-bom:28.2.1')
|
||||
googleImplementation 'com.google.firebase:firebase-core'
|
||||
googleImplementation 'com.google.firebase:firebase-analytics'
|
||||
googleImplementation 'com.google.firebase:firebase-crashlytics'
|
||||
googleImplementation 'com.google.android.gms:play-services-location:18.0.0'
|
||||
googleImplementation 'com.google.android.play:core:1.10.0'
|
||||
googleImplementation 'com.google.android.play:core:1.10.2'
|
||||
}
|
||||
|
||||
if (getGradle().getStartParameter().getTaskRequests().toString().contains('Google')) {
|
||||
|
||||
@@ -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