Fix background service error

This commit is contained in:
Tommaso Berlose 2021-01-12 09:51:00 +01:00
parent 0ea55db4b1
commit c389d50b09
3 changed files with 1 additions and 2 deletions

Binary file not shown.

View File

@ -22,7 +22,7 @@ android {
applicationId "com.tommasoberlose.anotherwidget" applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 30 targetSdkVersion 30
versionCode 125 versionCode 126
versionName "2.2.2" versionName "2.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@ -35,7 +35,6 @@ class UpdateCalendarService : Service() {
companion object { companion object {
const val CALENDAR_SYNC_NOTIFICATION_ID = 28468 const val CALENDAR_SYNC_NOTIFICATION_ID = 28468
fun enqueueWork(context: Context) { fun enqueueWork(context: Context) {
context.startService(Intent(context, UpdateCalendarService::class.java))
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
context.startForegroundService(Intent(context, UpdateCalendarService::class.java)) context.startForegroundService(Intent(context, UpdateCalendarService::class.java))
} else { } else {