I have cloned and ran the github https://github.com/firebase/friendlychat friendly chat project for Android. It is creating chat app between all users but I was expecting to see a notification since they have included FirebaseMessagingService in the code.
AM I expecting to much or I need to change something in code to get notification in my notification bar?
Any direction would be helpful.
Ok I was way off in my question.
So, in order to have one on one notification I had to create php files in my own server. My server code will have FCM key from firebase and when user sends a message, I send a push request from my application to server including receiver's FCM token, it will send a notification to Firebase and Firebase will send notification to the receiver.
Google have firebase functions and somehow you don't need your own server anymore but I am not sure how to implement that.
Related
I am new with Firebase. I want to send push notifications to an android app from a spring application. At preset I dont have an android app. I want to test whether the firebase integration is correct or not, which means I want to make sure that the push notifications sent from the backend server are recieved correctly in firebase .
How do I ensure that firebase has recieved the push notifications sent from backend server?
Is it possible to test push notifications without an android app registered on firebase? If yes, how do I do that?
I am using Firebase Admin SDK. Do I need a separate server key other than the service account key for sending notifications?
You'll get a success (or fail) response when sending messages. This means that FCM has received your message and it will try to deliver it to the users.
FCM needs to target your app in order to send notification. If you don't set up FCM SDK in your app, it wont be able to do so.
You just need to generate an auth token. This guide should help you set it up.
I have a net core Back-End (3.1).
I created a page in which admin should enter title and description and pick a user to send a notification.
I want to send notification payload to Apple devices and not to an android device similar to a custom notification.
there is a platform-specific notification in Firebase Cloud Messaging documentation .
However, I was not able to implement it .
If you wanna only send the notification to Apple devices only. Then APNS Push notification push gateway will be suitable for you. See here
Certainly, FCM can also deal with this issue. You need to add the ApnsConfig to your request and send it to the FCM server.
If you cannot implement it, you need to mention more detail about your issue (trace log, exception info, etc.)
I am creating mobile application using latest version of Ionic 3. And I am at the point where I need to implement push notifications. I am using FCM. I have managed to done it for Android phones using this plugin: https://github.com/phonegap/phonegap-plugin-push. Reading documentation for this plugin, it says that for Android I should send only Data Messages and that that is the best practice. It also says that send Notification and Data payload would not work properly:
When your app is in the foreground any on('notification') handlers you have registered will be called. If your app is in the background, the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your on('notification') handler will not be called as messages that have notification payloads will not cause the plugins onMessageReceived method to be called.
But for IOS I need to send notification message with data payload. This would not be a problem if I target directly devices, however I need to send Topic Messages. So the way I see is that on my server I need to implement this logic:
Let's say that the name of topic is FOOD-AND-DRINKS:
function onSomeEvent($data) {
// send push notification to topic ANDROID~FOOD-AND-DRIKS
// send push notification to topic IOS~FOOD-AND-DRINKS
}
Also, since in the future my plan will include multiple cities, and not all people would like to listen for notifications for cities other the one where that person lives, so then my topic would be PLATFORM~CITY~CATEGORY.
So my question would be, is there any better plugin for handling notifications, or some service between my server and Google FCM and that service would take care of that, or this is quite OK what I have proposed?
You can use cloud functions to be able to send notifications since you are using FCM also.
More on this here: https://firebase.google.com/docs/functions/
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
Using cloud functions you can use database triggers like onWrite() and it will be able to send notifications if you have data payload and/or notification.
But if you use data payload alone then you can send if android device is in background also.
Regarding Topics:
If you have multiple cities in your application, then you can let the user register to each topic. You can do in the database like this:
city-category
id_here
cityname: nameX
//other details
id_here1
cityname: nameY
//other details
I am storing the registration tokens in my database. I want to send push notifications to the single device by taking registration tokens from database but without using firebase console. How to do it?
You need an app server or some Google Chrome extention like PostMan.
First of all, you need to understand the differences between notification message and a data message, like how the app handles the incoming message if it is in the background state or on running on the foreground.
Secondly, create a payload and send a post request to FCM endpoint. It is well documented here.
Lastly, check the FCM response. Note that getting a success response doesn't mean that the message is already delivered to the app, but rather the FCM server accepted it for delivery.
If you would like to learn more about what parameters you can use and the definition of each response codes, check out the Firebase Cloud Messaging HTTP Protocol documentation.
I hope this helps.
If you are using Firebase database to store your tokens and intend to send the FCM notification during an event, I suggest making use of Cloud Functions for Firebase. See my answer here for an idea on how you might use it.
If you just want to send a simple downstream message, you could use Postman (also stated by #looptheloop88 in his answer) or cURL.
I was wondering if there's a way to send a push notification to a device from an android application that I developed or not. Also, if it is possible to develop my php server in a way that it would request a push notification to be sent to a specific device. I have already tested the SDK with my application and it receives the notification if I sent it from mixpanel.com. I just want to make the thing automated for convenience.
I'm trying to implement an application with a messaging feature and need to notify the user that will receive the message when they receive it. I read a lot about GCM and there doesn't seem any good documentation out there and everything doesn't work no matter what and I always get errors. Mixpanel should do the job, but in order for me to be able to send push notifications, I have to be logged in to their website and use the website to send the notification. I also tried to use HTTP request and send a request to the URL that sends the push notification, but I need to be logged in and it just doesn't work.
Any help would be much appreciated as I have to get this application done as soon as possible!
Thanks
You can get Mixpanel to send your push notifications automatically using the "Notifications" feature- you don't have to log in to Mixpanel every time. You can set up the notifications to be sent based on a user's properties. If you want to send a notification based on some event in your app, you can send a people analytics update to Mixpanel when that event occurs.
So suppose you want people to receive a push notification to their mobile device every time they sign up in your web app. On the "Thanks for signing up" page of your app, you'd put something like the following:
// Assuming you've added the Mixpanel JS snippet to your page
mixpanel.identify(SOME USER DISTINCT ID);
mixpanel.people.set("Signed Up", true);
Then, you could set up a notification in Mixpanel with "Signed Up Is True" in your Mixpanel project. The next time you set a user to "Signed Up", they'll get a GCM notification.