Skip to content Skip to sidebar Skip to footer

How To Stop Playing Notification Sound Programmatically On Android

I create notification using notification builder like this: NotificationCompat.Builder builder = new NotificationCompat.Builder(context); String someString = 'StackOverflow is the

Solution 1:

Grab instance of NotificationManager:

NotificationManagernotify_manager= (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Save somewhere ID of your notification and call

    notify_manager.cancel(your_id);

Or you can remove all notifications:

    notify_manager.cancelAll();

Solution 2:

notificationBuilder.setDefaults(0)

Post a Comment for "How To Stop Playing Notification Sound Programmatically On Android"