diff --git a/app/build.gradle b/app/build.gradle
index b6eb654..f5f7975 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -4,12 +4,12 @@ plugins {
}
android {
- compileSdk 33
+ compileSdk 34
defaultConfig {
applicationId "io.keepalive.android"
minSdk 22
- targetSdk 33
+ targetSdk 34
versionCode 120
versionName "1.2.0"
@@ -62,19 +62,19 @@ android {
dependencies {
// next versions require compile sdk 34+
- implementation 'androidx.core:core-ktx:1.10.1'
- implementation "androidx.activity:activity-ktx:1.7.2"
- implementation 'androidx.navigation:navigation-ui-ktx:2.6.0'
+ implementation 'androidx.core:core-ktx:1.13.1'
+ implementation 'androidx.activity:activity-ktx:1.9.0'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'com.google.code.gson:gson:2.8.9'
+ implementation 'androidx.appcompat:appcompat:1.7.0'
+ implementation 'com.google.code.gson:gson:2.11.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
// for encrypted shared preferences, no longer used
// implementation 'androidx.security:security-crypto:1.1.0-alpha06'
// work manager stuff, but also gives us ListenableFuture...
- implementation 'androidx.work:work-runtime-ktx:2.8.1'
+ implementation 'androidx.work:work-runtime-ktx:2.9.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
@@ -83,18 +83,18 @@ dependencies {
//implementation 'com.google.guava:guava:31.0.1-android'
// if this is google play, and not f-droid, then use the google play location library
- googlePlayImplementation 'com.google.android.gms:play-services-location:21.0.1'
+ googlePlayImplementation 'com.google.android.gms:play-services-location:21.3.0'
// test stuff
- testImplementation 'org.mockito:mockito-core:5.7.0'
+ testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'junit:junit:4.13.2'
// android instrumented test dependencies
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
- androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
- androidTestImplementation 'org.mockito:mockito-android:5.7.0'
- androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.2.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.6.1'
+ androidTestImplementation 'org.mockito:mockito-android:5.12.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
androidTestImplementation 'tools.fastlane:screengrab:2.1.1'
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 85e6c0b..2a97e0c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -22,6 +22,7 @@
+
+ android:foregroundServiceType="shortService|location" />
= android.os.Build.VERSION_CODES.Q) {
+
+ // if the user has enabled location then add the location type
+ if (prefs.getBoolean("location_enabled", false)) {
+ foregroundServiceTypes = foregroundServiceTypes or ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
+ }
+
+ // if this is API 34+ then add the new short service type
+ // https://developer.android.com/about/versions/14/changes/fgs-types-required#short-service
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ foregroundServiceTypes = foregroundServiceTypes or ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE
+ }
+ }
+
// start the service
- startForeground(AppController.ALERT_SERVICE_NOTIFICATION_ID, notification)
+ ServiceCompat.startForeground(
+ this,
+ AppController.ALERT_SERVICE_NOTIFICATION_ID,
+ notification,
+ foregroundServiceTypes
+ )
DebugLogger.d("AlertService", getString(R.string.debug_log_wake_lock_acquired))
wakeLock.acquire(wakeLockTimeout)
@@ -120,6 +146,8 @@ class AlertService : Service() {
.setContentTitle(getString(R.string.alert_service_notification_title))
.setContentText(getString(R.string.alert_service_notification_message))
.setSmallIcon(R.drawable.ic_notification)
+ // the OS may delay the visibility of the notification so force it to be visible immediately
+ .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
.build()
}