I have my XMPP server which was working with GCM. I upgraded to FCM as per google says though I am able to receive notifications from FCM notification console, not able to receive any upstream messages with FireBaseMessaging.send() ... If any one has done this migration please help.
Note : I have a XMPP server which was working and able to receive upstream messages via GCM. (After migration to FCM it is not receiving any messages even though the end points are changed. Am i missing anything from docs)
This is fixed ! while using both (GCM, FCM) dependency in my project I was using a string resource default-project_id from GCM dependency. I now removed and replaced that with the project_id and it is fixed. So endpoint change is not mandatory.
Make sure you update the server endpoints. Note that the new FCM version of gcm-http.googleapis.com/gcm/ is fcm.googleapis.com/fcm/ (without "http"):
Change GCM endpoint
gcm-xmpp.googleapis.com
to FCM endpoint
fcm-xmpp.googleapis.com
source: Migrate a GCM Client App for Android to Firebase Cloud Messaging
For more information, Check this Upstream message syntax for FCM and how to send Upstream messages on Android.
Related
I have FCM push notifications implemented on a server.
I want to additionally send APNS notifications via that server by sending as a FCM message that is forwarded by Firebase to APNS.
To do that I understand I need to add APNS certificate to the firebase console.
FCM push notifications on my server were implemented some time back when FCM HTTP legacy protocol was available and server API keys were visible in the Firebase console (I got the key from somewhere so I guess it was there).
My question is if I add (and perhaps later remove) an APNS certificate to my firebase console production project will that affect the validity of my existing server API key in any way. It is important that FCM continues to work seamlessly.
It doesn't seem possible to get a FCM HTTP legacy protocol server key now. If there is a way to do this then I could try this myself on a test project.
I've been implementing Notification Channels in my android app to support recent android versions.
You can set the notification channel id when sending messages from the firebase web console, but I was not able to find out how to set the channel id when sending messages via fcm rest api.
Notification channels are not mentioned in the reference (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages), but I am pretty sure there must be a way to set the channel id.
The key name I was missing is android_channel_id
I found the key name in the Legacy HTTP Server Protocol docs (https://firebase.google.com/docs/cloud-messaging/http-server-ref)
When I try to send Get Request in Postman in the Url
'https://iid.googleapis.com/iid/info/IID_TOKEN', it gives me Internal Server Error.
The IID_TOKEN I get is from FCM (Firebase Cloud Messaging) Server Key.
The YOUR_API_KEY I get is from FCM (Firebase Cloud Messaging) Legacy Server Key.
Am I sending the correct IID_TOKEN and YOUR_API_KEY? Or is it any authorization that I have not done?
Please help me on this.
Thank you.
How you obtain the IID_TOKEN depends on the client SDK you are using. In the Cloud Messaging Guide, the section for each client SDK (e.g. iOS, Android, Web, etc) has a topic titled Send Your First Message with a step describing how to obtain the registration token. For example, the Android description says to use FirebaseInstanceId.getInstance().getToken().
From your post, it sounds like you are using a server key, which is not correct.
There is an example GET request in the documentation.
I am using Google Channel to do Push notification from server. It's working fine, but when I open the debugger windows, I can see lot of polling request that are going to the server.
Is that the way push notification works? If yes, then what is the use of it?
var token ="<%token%>";// This will creaete unique identifier(some id created by google api + ur key)
channel = new goog.appengine.Channel(token);
socket = channel.open();
socket.onopen = function() {
$('#messages').append('<p>Connected!</p>');
};
Thanks.
GCM doesn't do that. Gonna refer to the official docs on it's flow.
Lifecycle Flow
Send and receive downstream messages.
Send a message. The app server sends messages to the client app:
The app server sends a message to GCM connection servers.
The GCM connection server enqueues and stores the message if the device is offline.
When the device is online, the GCM connection server sends the message to the device.
On the device, the client app receives the message according to the platform-specific implementation. See your platform-specific documentation for details.
Receive a message. A client app receives a message from a GCM connection server.
Also announced in the recent I/O 2016, GCM's successor is now Firebase Cloud Messaging, which not only has the Push Notification Service, but also has other features (one example is Analytics) for free.
So overall, using GCM (or FCM) is a simpler method than polling. It handles the queuing of the messages you sent, and some others.
Part of my answer here. Also includes an idea why Polling is not ideal when sending push notifications.
I am using AWS SNS for sending push notifications and I have used this article for the implementation http://mobile.awsblog.com/post/Tx223MJB0XKV9RU/Mobile-token-management-with-Amazon-SNS
I am storing the token and the endpoints in the server for sending the push notifications, but the problem is with GCM when the reg_id gets changed and pervious reg_id is still active then the aws update the pervious endpoint with latest token, due to which I have got two endpoints with same reg_id and when I am sending the push notification then it is getting delivered twice.
I have searched everywhere but I am not able to find the solution, how do I update my server DB to delete the older endpoint.