The goal I want to achieve for the app owner is to send FCM push notifications via web interface to the customers (already achieved) and to give the customers a view in my app, on which they can read all or at least the last 10 sent push messages. Is there any (REST) api in FCM which can be used to receive the sent push notifications and its content so I can display them in my Android fragment?
Unfortunately, there is no available API as of the moment to retrieve your GCM/FCM logs. However, there's been a recent improvement in the Firebase Notifications console where stats for messages sent using the FCM API is included in the Firebase Notification console stats.
The more details can be found from this answer and the blogpost.
Related
I want to see all the logs of push notifications received on my android device. I'm sending the FCM token of my device to my backend server, and the push is sent using PHP code to my device.
Does firebase console provide any statistics/logs of all push received for the specific device?
Firebase doesn't keep the track of device-specific notifications.
Instead, what you can do is while sending notifications from the back-end, just keep the track of notifications sent to specific devices by storing this data on your database, and then you can fetch it on your android device.
you could do kinda of that. Using analytics labels (only with FCM API v1) you can see on the firebase console the stats about received messages. If you use a specific label only for your device, you will know how many notification have been received by that specific device.
https://firebase.google.com/docs/cloud-messaging/understand-delivery?platform=android
Good afternoon!
We’ve faced the problem when we decided to use flurry and firebase for our Android app analytics. It works well in general, except push-notification analytics. We send push notifications via firebase. They are fully automated and sent from our backend. To make things clear, the event has happened and from the backend, it goes to firebase - the title, the text, the picture, FCM user’s token. Push comes and everything’s alright.
But in Events, these pushes are not being tracked. However, Firebase has original events: notification_dismiss notification_open notification_receive
It turned out that events worked only on those pushes that were sent from FCM and it’s unbelievable! In other words: you write text manually and get the statistic but Google says: “you don’t need 90% of statistic for automated pushes”.
So my question is: What shall we do? How can we track automated pushes that are being sent from the backend? Which analytics allows to track push notifications that are being sent from FCM API?
Shall we change analytics for push notifications?
The automatically collected notification events (notification_dismiss notification_open notification_receive) only populate in the Analytics console when the notifications are sent via Notification console.
Push notifications sent through server are not captured as part of the automatically collected notification events.
As a part of announcement of Android Wear 2.0 there was declared:
Standalone applications: direct network access to cloud (apps run on
watch even when your phone isn't with you).
The question is does this means that android wear application can get its own GCM/FCM registration ID and receive push notifications directly to the watch without phone at all? Can someone here prove it with documentation or on its own experience?
What happen if I have same applications on the device and watch, that receives push notifications?
Thanks in advance.
It is stated in the documentation of Android wear 2.0 under the Cloud Messaging that for sending notifications, apps can directly use Firebase Cloud Messaging (FCM). Note that FCM is supported on Wear 2.0. and GCM is not supported.
Here are the other details that you can find in this documentation.
FCM is the recommended way to send notifications to a watch.
Provide for messages from FCM by collecting a registration token for a device when your Wear app runs. Then include the token as part of the destination when your server sends messages to the FCM REST endpoint. FCM sends messages to the device identified by the token.
An FCM message is in JSON format and can include one or both of the following payloads:
Notification payload. When a notification payload is received by a watch, the data is displayed to a user directly in the notification stream. When the user taps the notification, your app is launched.
Data payload. The payload has a set of custom key/value pairs. The payload and is delivered as data to your Wear app.
Is possible to send push notifications with firebase without using the console,I mean can I send a push notifications when some user makes some action in the app?
Is possible to send push notifications with firebase without using the
console
Yes you can use Firebase API
I mean can I send a push notifications when some user makes some
action in the app?
You can subscribe to a topic when user makes some action in the app
FirebaseMessaging.getInstance().subscribeToTopic("news");
and send a notification from Firebase web console or use Firebase API to all topic subscribers.
You can send a message to a topic from the Firebase Cloud Messaging API.
But this requires the use of your FCM server key, which means it should only be done from an app server. You should never embed your server key in the client-side app. This means that direct device-to-device notifications are not possible at the moment, you will always need an app server for that.
For a tutorial explaining one possible scenario, see: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html
I am trying to migrate to Firebase cloud messaging from GCM and I noticed that when the application is not running the notifications are coming in the notifications tray. With GCM this was not the case, it was up to the developer to show a notification or not. I want to have similar behavior with FCM where when the app is running I want to silently handle the push message instead of having user to click on the notification and start the app. How can I achieve that.
Thanks,
P
Firebase Cloud Messages has two types of messages:
Notification Message: this type of message has the same behavior as the GCM messages
FCM automatically displays the message to end-user devices on behalf of the client app. Notification messages have a predefined set of user-visible keys
Data Message: this type has the behavior you described above.
Client app is responsible for processing data messages.
Data messages have only custom key-value pairs.
To send data messages you need to use the HTTP API [for Data Message]. (quoted from Arthur)
Full documentation: https://firebase.google.com/docs/cloud-messaging/concept-options