Skip to content

Commit

Permalink
fix [gotev#642]: fix in NotificationActionsObserver.kt as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kabirnayeem99 committed Oct 10, 2023
1 parent a962a92 commit 54e0fd8
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package net.gotev.uploadservice.observer.request
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import net.gotev.uploadservice.UploadService
import net.gotev.uploadservice.UploadServiceConfig
import net.gotev.uploadservice.UploadServiceConfig.broadcastNotificationAction
import net.gotev.uploadservice.UploadServiceConfig.broadcastNotificationActionIntentFilter
import net.gotev.uploadservice.extensions.uploadIdToCancel
Expand All @@ -28,7 +30,13 @@ open class NotificationActionsObserver(
}

fun register() {
context.registerReceiver(this, broadcastNotificationActionIntentFilter)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(
this, broadcastNotificationActionIntentFilter, Context.RECEIVER_NOT_EXPORTED
)
} else {
context.registerReceiver(this, broadcastNotificationActionIntentFilter)
}
UploadServiceLogger.debug(NotificationActionsObserver::class.java.simpleName, NA) {
"registered"
}
Expand Down

0 comments on commit 54e0fd8

Please sign in to comment.