Search code examples
androidandroid-notificationsandroid-pendingintent

For Notification : What is the difference between pendingIntent.cancel() and notificationManager.cancel(notification_id)


While doing the notification code, a doubt came in my mind. What is the difference between pendingIntent.cancel() and notificationManager.cancel(notification_id). I mean which one will clear the notification and what will the other one do?.


Solution

  • which one will clear the notification

    cancel() on NotificationManager will remove the Notification.

    what will the other one do?

    It cancels the PendingIntent, so it no longer can be used.