It is mentioned in the documentation that the builder method NotificationCompat.Builder(Context context)
has been deprecated. And we have to use the constructor which has the channelId
parameter:
NotificationCompat.Builder(Context context, String channelId)
NotificationCompat.Builder Documentation:
This constructor was deprecated in API level 26.0.0-beta1. use NotificationCompat.Builder(Context, String) instead. All posted Notifications must specify a NotificationChannel Id.
Notification.Builder Documentation:
This constructor was deprecated in API level 26. use Notification.Builder(Context, String) instead. All posted Notifications must specify a NotificationChannel Id.
If you want to reuse the builder setters, you can create the builder with the channelId
, and pass that builder to a helper method and set your preferred settings in that method.