Notifications/Cloud Messaging
Step 1:
Call Firebase Function from native app/web app to send a notification
Call firebase function from:
Android App
Call firebase function from:
Web App
Part one
Part Two
Step 2:
The Firebase function to send a notification/cloud message to all users:
Step 3 - The 3 states: (1)Background, (2)Not running and (3)in the app
Tap on notification and open an activity/alert with data when app is in the background or not running
Receiving notification when app is in the background:
By default notification shows on device notification list.
Receiving notification when is not running:
By default notification shows on device notification list.
Applies to background and not running state
When the firebase function fires, it needs to return data (shown above - messageData) which will allow you to access the information to display in your app.
---------------------------------------------------------------------------------------------------------------------
Receiving notification when you are in the app:
Put this in the manifest:
Create a class called “MyFirebaseMessagingService”
Step 4:
Tokens
When you are sending a notification to all users no tokens are required
-----------------------------------------------------------------------------------------------------------
If you are trying to send a notification to particular user then a token is required.
Comments
Post a Comment