I have to make a Rest API in Spring Java for a multi tier arch in which DAO, Controller, Service manager needs to be build for a Firebase Cloud Messaging (FCM) to send push notifications messages to android application, but I can not able configure a server in Java to send notifications to devices. How could I?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Here is the way that you can achieve this:
Step 1: Create project on firebase and generate server key.
Step 2: Generate a json object for fcm server. Here message may contains data object and notification object. It must also have receiver fcm id. Sample json is like:
Step 3 : Write a Rest caller service that will communicate with fcm server by following url:
Here is the sample working code:
You have to just call
sendPushNotification(List<String> receiverKeys, String messageTitle, String message)
then receiver will get push messageThanks :)
@Autowire the FCM in your @Component class after configure your FCM account. tutorial