Android / ソフト開発

Android開発 通知メッセージ削除

参考

Androidで着信通知を実装してみよう

GitHub のコード的には こちら

@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
fun onResume() {
    logD("onResume()")
    val notification = notificationPostman.findNotification(context, NotificationId.CALL.id)
    if (notification != null) {
        logI("Found call notification. Send fullScreenIntent.")
        try {
            notificationPostman.delete(context, NotificationId.CALL.id)
            notification.fullScreenIntent.send()
        } catch (e : PendingIntent.CanceledException) {
            e.printStackTrace()
        }
    }
}

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


2021年6月8日