I have documented this brief about the notification using this youtube video channel.
We want to send notification to all the devices those installed our App
Create firebase project from android studio wizard
Add FCM to your project. It will add the require dependency to your gradle.
Send registration token to firebase server by firebase store data on server api(any normal api to send a data to server)
Generate registration token which need to send to the server. each device has uniqe registration token
After firebase server get the token it will able to send a notification.
Declare firebase service class in the manifest which receive the firebase push notification event. it will receive the push notification fired by firebase
Using registration token firebase can send a push notification to particular device.
Google play service receive the notification and redirect to the corresponding app.
App receive the push in the code and display the notification.
we can not simple intent to start the activity as notification is not part of our application component. so for that pending intent is used. it is ment for future use.
while building notification object we can pass pending intent object so once notification is clicked the pending intent comes into the action