I am developing a chat app using Firebase as backend. It is required that on every new message receiver gets a push notification saying that he got a new message. This is first time I am doing something like this so I have a question:
Since we do not use our own server for this, do we need a 3rd party provider (like Batch for example) for handling push notifications? If I am not mistaken I think Firebase does not support sending push notifications like this but only ones you send from console.
Any help would be great.
Hope someone finds this useful, it helped in my case.
Currently sending push notifications from device to device isn't possible with solution Firebase offers. If you want that type of thing, you should try OneSignal which is free and very easy to implement.
(iOS) A little late; but perhaps can help anyone in the future with this.
I recently had this issue, and my solution was to utilize the device group method.
Ergo:
Would create a device group with the registration_ids (or array of device ids for the push)
Would then send the push to said device group
Delete device group
See: https://firebase.google.com/docs/cloud-messaging/ios/device-group
You can send a push notification from Android using Http POST request, i'm using retrofit to make this, example:
Url: https://fcm.googleapis.com/fcm/send
Http Headers:
Body(Json):
You can make a test using Advanced Rest Client "Extension of Google Chrome"
There are two features in the new Firebase to send notifications to users:
To send messages with Cloud Messaging, you need to specify an Authorization Key in a request. Since knowing this key allows sending of messages on your behalf, you'll want to limit access to it to trusted processes. This indeed can be a server, but any trusted process is fine.