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

Amazon SNS - how to know that app has been uninstalled?

I am new on Amazon SNS. I have apps that are using APNS and GCM through Amazon SNS. So every time a user installs my app, I would register them into GCM or APNS. I wanted to know when app my app has been uninstalled so that I can remove them in my…
2
votes
1 answer

GCM Push notification not received on single device android

GCM Push notification is not received to one device alone. It is working fine with other mobile devices. GCM token is registered and it is active. But the notification is pushed but not received. The device model which is not receiving is Moto G4.…
2
votes
1 answer

Manage registered GCM services

I'm new to Google clound messaging and need a hint. I registered two services on Google Developers page when I was enabling push notifications on Intercom. AppName-Beta AppName-Release Now I want to delete one of them and rename the other, because…
Martin
  • 94
  • 2
  • 12
2
votes
1 answer

Getting Unauthorized 401 for manifest.json GCM push notifications in ASP.NET

My manifest file is in the root folder, referenced in the _Layout view as following: The file structure is as following: { "gcm_sender_id": "MY_Sender_Id", "permissions": [ "gcm" ] } Keep getting 401…
2
votes
2 answers

ios push notification/ message without device token

I'm trying to send a push notification or a message from my IOT button to all the users who have installed my iOS and android app. Is it possible to do it, given that I don't have the user's device tokens with me?
2
votes
0 answers

Uploading APN cert in GCM error

I want to update my expired cert in GCM but their uploader seems to be not working. My certificate is not updating. Here is the image of error in GCM What is seem to be the problem here? I tried other browser or device but still not working. Is…
2
votes
0 answers

ShortcutBadger library implementation

I want to implement ShortcutBadge, to show counter for push notification on my app icon. gotten from: https://github.com/leolin310148/ShortcutBadger i have added the library successfully. my app has GcmMessageListenerService.java class. and below…
t.Oraps
  • 51
  • 1
  • 4
2
votes
1 answer

sending gcm upstream from iOS app when app is not in foreground + gcm API for uploading APNs certificate

I have two questions about APNs push notification using gcm library. Does gcm or fcm have a public api for uploading APNs certificates? I need to do this automatically instead of manually. It seems that sending upstream using gcm library in an iOS…
Akram
  • 2,158
  • 1
  • 17
  • 24
2
votes
0 answers

Can I use Firebase Cloud Messaging for mobile browser?

I've been using Firebase Cloud Messaging for desktop browser via the FCM JavaScript API. Does anyone know if this can be used for mobile browsers? Been running into difficulties when trying to get the mobile browser token so that specific browsers…
2
votes
1 answer

First cURL request validating GCM api key

Currently trying to build my first android app with a GCM API key which will be used by a piece of marketing software to send push notifications. Wanted to get some help validating my google cloud message (GCM) API key with a curl request. I've…
chris
  • 861
  • 1
  • 7
  • 15
2
votes
3 answers
2
votes
0 answers

Group wise Push Notifications

I have a few admin users in my android app and others are normal users. the mapping between them is one to many i.e. each admin is mapped to one or many users but each user must have only one admin. how can i configure my app so that admin users can…
2
votes
1 answer

GCM message is not received on broken network about 15-30 minute

connect my Android device to WIFI AP. remove WLAN cable from AP, and connect it again. Trying send a GCM message to my device, but message's not arrived. after 15-30 min, GCM message's arrived. I think GCM service is trying to send a refresh…
pokoso
  • 997
  • 1
  • 6
  • 12
2
votes
0 answers

Xamarin Android GCM Registration (502 Error)

I'm trying to Register push notificationninmy Xamarin Android project. I get a Bad Gateway exception in the Register func of the GCMService class. Specifically a 502 error as follows. "502 - Web server received an invalid response while acting as a…
2
votes
0 answers

How can I create FCM token for web application?

I want to create FCM token for web application based on this i want to send push notifications.Is it possible?Can i expect sample code for this? I try this one var config = { apiKey: "AIzaSyC2GoeeoYfPTgP61w77FMPFep-cLBz9Pmc", authDomain:…
1 2 3
99
100