How to send notification to the device through gcm - google-cloud-messaging

Hi i am getting this message when i try to test gcm with php and MySQL,i don't,know how to integrate gcm with PHP and MySQL
{"multicast_id":7670730794440128024,
"success":0,"failure":1,
"canonical_ids":0,
"results":[{"error":"InvalidRegistration"}]}

Check your API Key is correct or not in Google’s API console.

Related

GCM To FCM Migration For Push Notification Android

I am Migrating From GCM to FCM FOR SENDING Push notification to my some Android application of my Organization.
I have changed the GCM End Point to FCM End Point at Server Level.
I want to know Two Things related to this Migration -
1) when gcm api will depreciated after 11 april , 2019, Do i need to change my existing Project From Google Console to FCM Console or There is no need to change existing project from Google Console.
2)Do we need to change any code at application level (Client Side) for getting Push notification because we have used FCM End Point URL in place of GCM Url (Keeping rest of code logic same) at server end .
Please suggest.

GCM migration to FCM

I am confused about GCM to FCM migration.
I was sending data only, so I could wake up my app when it was closed, and got into onmessagereceive.
With my migration to FCM, it no longer works, and saw following :
A service extending GcmListenerService is now required only for the following use cases:
receiving messages with data payload only.
WHat exactly needs to be maintained from the GCM part. Do I need to have both FCM and GCM in my manifest, and do I need to have both FCMlistenerservice AND GCMlistenerservice ?
If only GCMlistenerservice is required, what is then the use of the FCM migration , and why is this data payload only not integrated in the FCM ?
Thanks in advance
Best regards
Ludo Kustermans

PushSharp - GCM Authorization Failed

Using v4.0.10 of Pushsharp (nuget package), I am getting error GCM Authorization Failed when sending push notifications to Android devices.
Seems the bug raised in issue 574 (https://github.com/Redth/PushSharp/issues/574 ) has been compiled into the nuget package, yet I'm still getting this error.
Could this be related to the introduction of Firebase Cloud Messaging?
Does anyone still have success using GCM?
As of right now, GCM is still usable. However, it is highly encouraged for new users to use FCM instead. Either way, for both GCM and FCM, you must use a Server Key generated from the Firebase Console. There is a visible note in the GCM docs saying:
Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
The Authorization error has been encountered by number of users, some also had an old project. See my answer here for more details.
The sender id used in the app code needs to match the sender id Firebase Cloud Message Console and its corresponding "Firebase Cloud Messaging token".
Thank you #AL for your help.

Gcm with appodeal

I am using gcm with appodeal in my app and when I am sending the push notification the for the first push was successful but phone is not receiving the notification and after that error is there while sending push that device is not register. What to do in this situation please help me.
Is it iOS or Android ? I had the exact same issue just yesterday with iOS and all I had to was to create a development provisioning profile and set it up properly in xCode. I hope that helps you.
I think for you to verify that your app can send and receive messages, client apps must register with GCM.
To register with GCM:
1.The client app obtains a registration token using the Instance ID API. The call to this API must have the authorized entity set to your app server's sender ID, and the scope set to the appropriate value for GCM (depending on your platform). Refer to the API reference for full detail on this API.
2.The client app passes the registration token to the app server.
3. The app server saves the registration token and acknowledges to the client app that the process completed successfully.
This thread may also provide further insight as to why you are receiving the device not registered error.

tagged push notification to android (google cloud messaging) using azure

I am using Azure's Notification Hubs REST APIs to create a Native registration for Google Cloud Messaging with a tag. (http://msdn.microsoft.com/en-us/library/dn223264.aspx)
The API call runs successfully and returns a RegistrationId as well as my tags in the XML response:
<GcmRegistrationDescription
<RegistrationId>222222222222222222222-1111111111111111111-2</RegistrationId>
<Tags>toto ,titi</Tags>
</GcmRegistrationDescription>
However with the debug console, I fail to push a message to that tag with the error below:
No registrations with the tag "toto" were found for the selected platform.
The Read Registration method of the REST api does not return the tags either. It returns an Etag element.
<GcmRegistrationDescription>
<ETag>4</ETag>
<RegistrationId>222222222222222222222-1111111111111111111-2</RegistrationId>
</GcmRegistrationDescription>
The same works great for the iPhone when creating a Native registration for Apple Push Notification Service.
Any ideas on what I missed would be greatly appreciated!