Change AndroidAlarmManager to use ContextCompat and add ContextCompat.RECEIVER_NOT_EXPORTED to work with api 34
This commit is contained in:
parent
c9d631d8b0
commit
fb5cc67977
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import com.fsck.k9.backend.imap.SystemAlarmManager
|
import com.fsck.k9.backend.imap.SystemAlarmManager
|
||||||
import com.fsck.k9.helper.AlarmManagerCompat
|
import com.fsck.k9.helper.AlarmManagerCompat
|
||||||
import com.fsck.k9.helper.PendingIntentCompat.FLAG_IMMUTABLE
|
import com.fsck.k9.helper.PendingIntentCompat.FLAG_IMMUTABLE
|
||||||
|
@ -40,7 +41,8 @@ class AndroidAlarmManager(
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val intentFilter = IntentFilter(ALARM_ACTION)
|
val intentFilter = IntentFilter(ALARM_ACTION)
|
||||||
context.registerReceiver(
|
ContextCompat.registerReceiver(
|
||||||
|
context,
|
||||||
object : BroadcastReceiver() {
|
object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
val callback = callback.getAndSet(null)
|
val callback = callback.getAndSet(null)
|
||||||
|
@ -54,6 +56,7 @@ class AndroidAlarmManager(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
intentFilter,
|
intentFilter,
|
||||||
|
ContextCompat.RECEIVER_NOT_EXPORTED,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue