Questions tagged [google-cloud-messaging]

Google Cloud Messaging is a service to allow data to be sent remotely to Android and iOS applications and Chrome extensions and packaged apps.

Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits the reliable and scalable GCM infrastructure, plus new features! See the FAQ to learn more. If you are integrating messaging in a new app, start with FCM. GCM users are strongly recommended to upgrade to FCM, in order to benefit from new FCM features today and in the future. See the FCM tag.

Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps. This includes downstream messages from servers to client apps, and upstream messages from client apps to servers. The GCM service handles all aspects of queueing of messages and delivery to client applications running on target devices, and it is completely free.

The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The service handles all aspects of enqueuing of messages and delivery to the target application running on the target device.

The free service has the ability to send a lightweight message informing the Android application of new data to be fetched from the server. Larger messages can be sent with up to 4 KB of payload data. Each notification message size is limited to 1024 bytes, and Google limits the number of messages a sender sends in aggregate, and the number of messages a sender sends to a specific device.

For example, a lightweight downstream message could inform a client app that there is new data to be fetched from the server, as in the case of a "new email" notification. For use cases such as instant messaging, a GCM message can transfer up to 4kb of payload to the client app. The GCM service handles all aspects of queueing of messages and delivery to and from the target client app.

Send messages from the cloud

Send a message using GCM HTTP connection server protocol:

  https://gcm-http.googleapis.com/gcm/send
  Content-Type:application/json
  Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
  {
    "to": "/topics/foo-bar",
    "data": {
      "message": "This is a GCM Topic Message!",
     }
  }

Handle a downstream message on an Android device:

  @Override
  public void onMessageReceived(String from, Bundle data) {
     String message = data.getString("message");
     Log.d(TAG, "From: " + from);
     Log.d(TAG, "Message: " + message);
     // Handle received message here.
  }
7283 questions
2
votes
1 answer

How to deep link web push notification using twilio

I have implemented web push notifications using twilio. It works well on desktop and mobile phones.But, I am struggling to handle clicks on the notification on mobile. For desktop it works fine with the following code in the service…
2
votes
1 answer

Can I send push notification without using device token

I want to send automatic push notifications to my clients who are installing my flutter application. Can I do it without getting their device tokens. I am using firestore as my database
Hasini
  • 327
  • 4
  • 19
2
votes
1 answer

Sending Push Notifications to Web Application without user consent

I want to send push notifications to my web application users on the occurrence of certain events by updating an icon with a red dot. This is similar to Facebook updating the "notification bell" icon with a dot, on receiving a message or getting a…
2
votes
2 answers

dependency error while adding firebase messaging to a flutter android project

I've added firebase messaging to my Flutter project. Works fine on iOS, getting an error when trying to run on Android: Android dependency 'androidx.localbroadcastmanager:localbroadcastmanager' has different version for the compile (1.0.0-rc01) and…
user6097845
  • 1,257
  • 1
  • 15
  • 33
2
votes
1 answer

Customize layout with Firebase Cloud messaging

I am going to use Firebase cloud messaging in my Android App to send reminder and notifications to users to get them more engaged with my app. For that reason, I want to have a custom look of the notification. I have gone through the Cloud Messaging…
2
votes
1 answer

Android app crashes when receiving a new FCM message (foreground and background)

I am working on implementing FCM in my app. I'm following the guide on the documentation and trying to implement a simple test as suggested in the documentation, but whenever I send a notification from the console the app crashes, weather it is in…
2
votes
1 answer

Not able to send an iOS CriticalAlert to Firebase Cloud Messaging

I have an in house application where I have the criticalAlert option setup within my application. I have confirmed that when I send the following with the pushy application, I am able to get the Critical Alert to work on the iOS application. The…
2
votes
1 answer

Is the firebase cloud messaging registration token per app or per device?

If I distribute two apps x and y (under the same developer account), will a user who has both apps installed have the same token for both apps?
lf215
  • 1,185
  • 7
  • 41
  • 83
2
votes
1 answer

Which version of gcm server to use for gcm - fcm migration

As gcm is deprecated we want to migrate our code. As in the migration guide of google mentioned there should only be the necessity to change the endpoint from gcm to fcm for our server application. App migration was already done successful. We are…
Florian
  • 21
  • 2
2
votes
1 answer

Android: CipherStream-API for AEAD Ciphers inacceptable slow

We are having an android app which a decrypting and encrypting large (up to 100MB) files over HTTP-Streams. Therefore, we are using CipherInputStreams and CipherOutputStreams which works fine for AES/CBC/PKCS7Padding. We recently switched to…
Timo
  • 357
  • 1
  • 3
  • 7
2
votes
2 answers

What's the server endpoint for test for GCM or FCM?

The URL https://fcm.googleapis.com/fcm/send is for production, I want to know the endpoint for test environment as I want test and production to point to different remote systems. What is the URL for test? On this page…
user9709765
2
votes
1 answer

Chrome Browser GCM - TOO_MANY_REGISTRATIONS - How to unregister/clear all registered app ids (registration.pushManager.subscribe)

I'm developing a service worker and push notifications for one of my projects. I did a mistake and as a result I registered in my browser more than 2k apps. On the page chrome://gcm-internals I see 2450 similar records: Registered App Ids:…
2
votes
1 answer

Server api key: migration doc vs migration video

The only change that the GCM -> FCM migration doc requires is changing the endpoint: Update your server code to use new FCM endpoints for sending messages via HTTP and XMPP... Optionally, you may want to evaluate the FCM HTTP v1 API, which offers…
lf215
  • 1,185
  • 7
  • 41
  • 83
2
votes
0 answers

If the old app using GCM does not have plans to migrate to FCM ,What happens post April 2019?

Does the old app using GCM still work if the app is not migrated to FCM post April 2019 by changing only the server end point to FCM ? And from the FAQ: "Note that client SDKs and GCM tokens will continue to work indefinitely. However, you won't be…
2
votes
2 answers

Is there dry_run functionality in FCM?

GCM has dry_run functionality: This parameter, when set to true, allows developers to test a request without actually sending a message. GCM is being deprecated in favor of FCM, but I don't see a similar feature in FCM. Does FCM allow you to do…
lf215
  • 1,185
  • 7
  • 41
  • 83