private void cancelPreviousWebRtcNotifications(){
  Set<String> notificationIds=mSharedPreferences.getStringSet(WEBRTC_NOTIFICATION_IDS,null);
  if (notificationIds == null)   return;
  Iterator<String> iterator=notificationIds.iterator();
  while (iterator.hasNext()) {
    mNotificationManager.cancel(NOTIFICATION_NAMESPACE,Integer.parseInt(iterator.next()));
  }
  SharedPreferences.Editor sharedPreferenceEditor=mSharedPreferences.edit();
  sharedPreferenceEditor.remove(MediaCaptureNotificationService.WEBRTC_NOTIFICATION_IDS);
  sharedPreferenceEditor.apply();
}

private void cancelPreviousWebRtcNotifications ( ) { Set < String > notificationIds = mSharedPreferences . getStringSet ( WEBRTC_NOTIFICATION_IDS , null ) ; if ( notificationIds == null ) return ; Iterator < String > iterator = notificationIds . iterator ( ) ; while ( iterator . hasNext ( ) ) { mNotificationManager . cancel ( NOTIFICATION_NAMESPACE , Integer . parseInt ( iterator . next ( ) ) ) ; } SharedPreferences . Editor sharedPreferenceEditor = mSharedPreferences . edit ( ) ; sharedPreferenceEditor . remove ( MediaCaptureNotificationService . WEBRTC_NOTIFICATION_IDS ) ; sharedPreferenceEditor . apply ( ) ; }
cancel all previously existing notifications . essential while doing a clean start ( may be after a browser crash which caused old notifications to exist ) .
