public void stopPushNotifications()

in sdk/communication/azure-communication-chat/src/main/java/com/azure/android/communication/chat/implementation/notifications/fcm/PushNotificationClient.java [121:156]


    public void stopPushNotifications() {
        if (!this.isPushNotificationsStarted) {
            return;
        }

        String skypeUserToken;
        try {
            try {
                skypeUserToken = communicationTokenCredential.getToken().get().getToken();
            } catch (ExecutionException | InterruptedException e) {
                throw logger.logExceptionAsError(
                    new RuntimeException("Get skype user token failed for push notification: " + e.getMessage()));
            }

            try {
                this.registrarClient.unregister(skypeUserToken);
                this.logger.info("Successfully stopped push notification!");
            } catch (Throwable throwable) {
                throw logger.logExceptionAsError(new RuntimeException(throwable));
            }
        } catch (RuntimeException e) {
            this.logger.warning("Unregistered push notification with error: "
                + e.getMessage()
                + ". Would just clear local push notification listeners.");
        }

        this.isPushNotificationsStarted = false;
        this.pushNotificationListeners.clear();
        if (this.registrationRenewScheduleTimer != null) {
            this.registrationRenewScheduleTimer.cancel();
            this.registrationRenewScheduleTimer = null;
        }
        if (this.workManager != null) {
            this.workManager.cancelAllWork();
        }
    }