Send notification for quit + foreground + background
@Slf4j@SpringBootTestpublicclassFcmTests{@AutowiredFirebaseMessagingfirebaseMessaging;@Testpublicvoidtest1()throwsFirebaseMessagingException{log.info("FCM Sending...");List<String>registrationTokens=Collections.singletonList("<your fcm token here>");// iOS ConfigApsaps=Aps.builder().setContentAvailable(true).build();ApnsConfigapnsConfig=ApnsConfig.builder().setAps(aps).build();// android configAndroidConfigandroidConfig=AndroidConfig.builder().setPriority(AndroidConfig.Priority.HIGH).build();MulticastMessagemessage=MulticastMessage.builder().putData("title","you can do everything").putData("id","1").putData("body","jumppp....").setAndroidConfig(androidConfig).setApnsConfig(apnsConfig).addAllTokens(registrationTokens).build();BatchResponseresponse=firebaseMessaging.sendMulticast(message);// See the BatchResponse reference documentation// for the contents of response.log.info("FCM Send success count=[{}]",response.getSuccessCount());}}
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)