Skip to content

Send push notification from Java Spring boot using firebase to Frontend Client.

License

Notifications You must be signed in to change notification settings

faizansalamat/firebase-java-push-notification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Generate a new Private key from

settings/serviceaccounts/adminsdk in firebase. It will download a json file.

Paste this json file under resources' folder.

Magic happens under FirebaseMessagingService

Notification.Builder builder = Notification
.builder();
builder.setTitle(note.getSubject());
builder.setBody(note.getContent());
builder.setImage(note.getImage());
Notification notification = builder
.build();

    Message message = Message
            .builder()
            .setNotification(notification)
            // This token will be generated from the Frontend. By integrating firebase in Frontend
            .setToken("cEudZcbCvdCojLONdFdOtV:APA91bHwU4YP-JhmSCepDW9ZgvRwNInM4n0wxBmPRetR_t73Ur3NPXmpiqxnXl7xLJLcgK9bEylJ7ObtFQ96poh9-9e_894Fevl-TuEvuvgn34y6h3AYbFFtiQgV88BRn9jEp9ozwvht")
            .putAllData(note.getData())
            .build();

About

Send push notification from Java Spring boot using firebase to Frontend Client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages