/** * Process the HTTP POST to the FCM infrastructure for the given list of registrationIDs. */ private void processFCM(AndroidVariant androidVariant, List<String> pushTargets, Message fcmMessage, ConfigurableFCMSender sender) throws IOException { // push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed. if (pushTargets.get(0).startsWith(Constants.TOPIC_PREFIX)) { // perform the topic delivery for (String topic : pushTargets) { logger.info(String.format("Sent push notification to FCM topic: %s", topic)); Result result = sender.sendNoRetry(fcmMessage, topic); logger.trace("Response from FCM topic request: {}", result); } } else { logger.info(String.format("Sent push notification to FCM Server for %d registrationIDs", pushTargets.size())); MulticastResult multicastResult = sender.sendNoRetry(fcmMessage, pushTargets); logger.trace("Response from FCM request: {}", multicastResult); // after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion: cleanupInvalidRegistrationIDsForVariant(androidVariant.getVariantID(), multicastResult, pushTargets); } }
/** * Process the HTTP POST to the FCM infrastructure for the given list of registrationIDs. */ private void processFCM(AndroidVariant androidVariant, List<String> pushTargets, Message fcmMessage, ConfigurableFCMSender sender) throws IOException { // push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed. if (pushTargets.get(0).startsWith(Constants.TOPIC_PREFIX)) { // perform the topic delivery for (String topic : pushTargets) { logger.info(String.format("Sent push notification to FCM topic: %s", topic)); Result result = sender.sendNoRetry(fcmMessage, topic); logger.trace("Response from FCM topic request: {}", result); } } else { logger.info(String.format("Sent push notification to FCM Server for %d registrationIDs", pushTargets.size())); MulticastResult multicastResult = sender.sendNoRetry(fcmMessage, pushTargets); logger.trace("Response from FCM request: {}", multicastResult); // after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion: cleanupInvalidRegistrationIDsForVariant(androidVariant.getVariantID(), multicastResult, pushTargets); } }
return Response.created(uriInfo.getAbsolutePathBuilder().path(String.valueOf(androidVariant.getVariantID())).build()).entity(androidVariant).build();
validateModelClass(updatedAndroidApplication); } catch (ConstraintViolationException cve) { logger.info("Unable to update Android Variant '{}'", androidVariant.getVariantID()); logger.debug("Details: {}", cve);