How to send a notification when Firebase database has been updated? - android

The latest launch of Firebase notifications feature allows to manually give the time and content of notification. Is it possible to automate it so that notification is received every time a particular variable is changed in the Firebase database?

Thanks for the reply Hamid. I didn't want to get into the technicalities of GCM therefore I implemented the notifications using a service. This service listen on the Firebase database and sends a notification whenever new data is added there.

I think you would have to setup a GCM (Switched to FCM now) server that handles all that. But I also do wish that there was a simple way of setting that up without needing to build a full server.
There is a friendlyping application that helped me set the XPMM server.
I think the current Firebase Notifications are very much in its early days. It doesn't provide many of the functionalities of Batch.com or Parse Server... yet.

Related

How can I set up an app server to send device to device notification via FCM?

I have set up push notification from Firebase console and I can send push notifications. However, I cannot send device-to-device notification yet. As I gather I would need an external app server that would observe Firebase nodes for change and then would fire off a notification via FCM.
I have seen similar question in SO here and a good but brief and not so complete explanation by Frank van Puffelen here. But I am still quite confused. Any tutorial or help as to how I can set up an app server (XMPP here) that would do the communication between client app instances and Firebase for sending notification when ChildAdded or modified and handling the key exchanges would be appreciated. (as I understand, FCM needs XMPP protocol for sending upstream notification)
Any help would be appreciated.
Following this tutorial.
Send Notifications from Server
What you can do is, setup an external server using your favorite technology to listen child_added or changed and respond to the notification requests.
We used the node.js app engine to handle this. Again the funda is to move people to use other cloud paid services.
Yours it's a good question... The firebase can't send push device-to-device, then if you want to do this one, needs a app server as you said. The other possibility that I thought for a long time is a create a independent service to do two things, the first one is constantly controls events as onChildAdded, for exemple and the second one, throws local notifications.
This is solution that i think works fine before to create a app server... At final if you try to do it, explain us your experience please! Greetings!

Android - How to make push-notifications in android

I want to notify android users(students) whenever they got failing grades. I tried using Firebase notification, but what I can do about it is to manually type messages in my firebase account and send it to users. I want to send notification to specific users automatically depending on the condition in my codes. Thanks in advance.
I suggest you to start with Firebase Notification
Less code and reliable
You can start with code sample
https://firebase.google.com/docs/samples/#android
and find the Cloud Messaging sample
You can also archive this by using Realtime Database that will provide data changed listener every time data is added/updated. And you can take this advantage of the listener to notify your Notification in Android

Firebase notification on child added/modified

Is it possible to generate a push notification (if the app is not in the foreground) on firebase db changes? I started coding an android app.
Firebase provides a tool called Cloud Functions.
With this, you can listen to your Firebase Database and send Notifications without the need for an external server :)
See : https://firebase.google.com/docs/functions/use-cases
To do it in a simple way, you can use a Service, in this Service you can set a Listener on a ref in your firebase DB when the event is triggered you can create a notify and show it to the user.
This is a very simple tutorial:
https://www.simplifiedcoding.net/android-push-notification-tutorial-using-firebase/
There certainly is. Just have your Android app write the notification request into the database.
Sending device-to-device notifications is not a supported scenario in Firebase Cloud Messaging (see this answer), so you'll need a server component for that. For an example of how to send a push notification in nodejs, see this answer.

firebase scheduled notifications

For my app, I want users to schedule the time which they receive a specific notification. I was looking over the Firebase docs and could not find a method that would allow me to do this. Is there a way to allow users to schedule notifications with Firebase? My app is still using parse api but as of now parse notifications do not support scheduled pushes.
If plan to use the Firebase console to send messages, there's a simple option to define a time in which you you want the message to go out.
If you plan to send messages via SDK. at this time there is no setting to handle scheduling, you'll have to handle it on your server.

android, automatic push update data for apps

I want to push new data to the apps on user's device after a couple of days, like news update service. It's NOT APK update. Where do I get some clues to start with? tks in advance
(sorry if this question is dumb, but why can't I search for it on stackoverflow, I must miss something?).
You can accomplish this in many different ways. One option is to design your app to periodically query a server-side REST API and download new information in an JSON/XML format. That information can be stored in a local SQLite or flat file database on the device. You could also integrate with Google's Cloud Messaging service to send push notifications to the device. When your application receives a push message it could spawn a new background process to download any updated content from your server.
You can use push notification (search for c2dm) which will notify users whenever, content/data is updated on server. Whenever, android application will receive push message from server, it will update the local database (say, news database in your case) from server.
Hope it is helpful information for you.
Just upload the new app, with the same key that you used it previously and also increment the version code.

Categories

Resources