This commit is contained in:
Tommaso Berlose 2021-01-14 14:14:00 +01:00
parent 6ea40a51fe
commit cce86a970c
3 changed files with 4 additions and 12 deletions

View File

@ -57,8 +57,6 @@ class UpdatesReceiver : BroadcastReceiver() {
}
Actions.ACTION_REFRESH -> {
ActiveNotificationsHelper.clearLastNotification(context)
GlobalScope.launch(Dispatchers.IO) {
CalendarHelper.updateEventList(context)
MediaPlayerHelper.updatePlayingMediaInfo(context)

View File

@ -34,6 +34,7 @@ class LocationService : Service() {
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
startForeground(LOCATION_ACCESS_NOTIFICATION_ID, getLocationAccessNotification())
job?.cancel()
job = GlobalScope.launch(Dispatchers.IO) {
if (ActivityCompat.checkSelfPermission(
@ -85,11 +86,7 @@ class LocationService : Service() {
@JvmStatic
fun requestNewLocation(context: Context) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
context.startForegroundService(Intent(context, LocationService::class.java))
} else {
context.startService(Intent(context, LocationService::class.java))
}
ContextCompat.startForegroundService(context, Intent(context, LocationService::class.java))
}
}

View File

@ -35,11 +35,7 @@ class UpdateCalendarService : Service() {
companion object {
const val CALENDAR_SYNC_NOTIFICATION_ID = 28468
fun enqueueWork(context: Context) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
context.startForegroundService(Intent(context, UpdateCalendarService::class.java))
} else {
context.startService(Intent(context, UpdateCalendarService::class.java))
}
ContextCompat.startForegroundService(context, Intent(context, UpdateCalendarService::class.java))
}
}
@ -55,6 +51,7 @@ class UpdateCalendarService : Service() {
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
startForeground(CALENDAR_SYNC_NOTIFICATION_ID, getCalendarSyncNotification())
job?.cancel()
job = GlobalScope.launch(Dispatchers.IO) {