Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
override fun onCreate() {
super.onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
alarmReceiver = AlarmReceiver()
registerReceiver(
alarmReceiver,
IntentFilter(android.app.AlarmManager.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED),
)
}
}
override fun onDestroy() {
alarmReceiver?.let {
Log.d(TAG, "onStop: Un-register receiver")
unregisterReceiver(it)
}
super.onDestroy()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment