catch exceptions thrown at showing alarms
This commit is contained in:
parent
5a78285931
commit
e8e168355e
1 changed files with 6 additions and 1 deletions
|
@ -16,6 +16,7 @@ import com.simplemobiletools.clock.activities.ReminderActivity
|
||||||
import com.simplemobiletools.clock.extensions.*
|
import com.simplemobiletools.clock.extensions.*
|
||||||
import com.simplemobiletools.clock.helpers.ALARM_ID
|
import com.simplemobiletools.clock.helpers.ALARM_ID
|
||||||
import com.simplemobiletools.clock.helpers.ALARM_NOTIF_ID
|
import com.simplemobiletools.clock.helpers.ALARM_NOTIF_ID
|
||||||
|
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
import com.simplemobiletools.commons.helpers.isOreoPlus
|
||||||
|
|
||||||
class AlarmReceiver : BroadcastReceiver() {
|
class AlarmReceiver : BroadcastReceiver() {
|
||||||
|
@ -59,7 +60,11 @@ class AlarmReceiver : BroadcastReceiver() {
|
||||||
.setCategory(NotificationCompat.CATEGORY_ALARM)
|
.setCategory(NotificationCompat.CATEGORY_ALARM)
|
||||||
.setFullScreenIntent(pendingIntent, true)
|
.setFullScreenIntent(pendingIntent, true)
|
||||||
|
|
||||||
|
try {
|
||||||
notificationManager.notify(ALARM_NOTIF_ID, builder.build())
|
notificationManager.notify(ALARM_NOTIF_ID, builder.build())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
context.showErrorToast(e)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Intent(context, ReminderActivity::class.java).apply {
|
Intent(context, ReminderActivity::class.java).apply {
|
||||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
|
Loading…
Reference in a new issue