Does firebase handle push notifications?

2019-01-08 20:47发布

问题:

I am investigating whether firebase and angularfire are a good fit for my upcoming project.

One of the requirements are for users to be notified when the app is closed on new private messages sent to user, ie. push notifications.

Does firebase handle this?

回答1:

Yes. This was not the case until recently, though.

Thanks to @libik for providing relevant documentation link:

https://firebase.google.com/docs/cloud-messaging/server#http-request

Update 5/2016 :

on Google io 16 , Google announced FCM - Firebase cloud messaging service.

With the announced expansion of Firebase at Google I/O recently, we also introduced Firebase Cloud Messaging (FCM) and Firebase Notifications (FN). As a developer, there are lots of updates that you might be able to take advantage of.

see more at : https://developers.googleblog.com/2016/05/google-cloud-messaging-and-firebase.html

documentation : https://firebase.google.com/docs/cloud-messaging/#key_functions



回答2:

As of today, the Google I/O has announced the new Firebase Cloud Messaging Service does now support sending push notifications. It integrates with Google Cloud Messaging to deliver messages upstream and downstream!

You can read more about it here:

  • Firebase Cloud Messaging

And the Firebase Cloud Messaging reference is here:

  • Firebase Cloud Messaging reference


回答3:

firebase is a storage. You wouldn't expect storage to do any actions.

For local notification generated by app when it is in the background you can constantly listen to changes in firebase and when the change occurs you can generate your push notification. In order to save the connection time since you are charged by concurrent connections, you can go offline and go online every 5 min for 20s. During this time firebase sdk connects to server, collects all the changes and runs all callbacks. You decide within your app what to do.

If you would like to enjoy remote push notification. You would need to setup a server listening to changes on firebase and talking to APNS which will push the notification to client's device.



回答4:

Batch.com is offering a Push Notification service for Firebase

https://batch.com/parse-replacement-with-firebase



回答5:

Actually, today (May 19, 2016) Google rebranded GCM to Firebase Cloud Messaging and it now offers this cross platform service. Firebase also offers notifications.

These are the differences between these two services:

  • Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.
  • Firebase Notifications is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, Firebase Notifications lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns.

If you want a more detailed comparison. Read this.



回答6:

The answer is YES!

At 2017 Firebase published Cloud function. You can use a database trigger to send a push notification (using FCM) even when the app is closed.

I have created a tutorial for firebase cloud function and Xcode(iOS) if you're interested, for the javascript it's the same code: https://www.youtube.com/watch?v=jOJdlvMS6KA