I have an android app on google play store, when I try to send push notifications on it, all of sent pushes are reported as "Unauthorized", this is happening while I can send push notifications to my test devices successfully.
What could be the problem?
I'm using a GCM Api key (which I think it's functional as I can send test pushes successfully) and these are my project dependencies:
compile 'com.pushwoosh:pushwoosh:4.10.8'
compile "com.google.android.gms:play-services-gcm:10.2.4"
The user from the post in community.pushwoosh.com has the same issue with you. Here is the solution.
Please note that the "Unauthorized" error in the Control Panel means
that Pushwoosh cannot authorize at GCM while sending push
notifications. Most probably, something is wrong with the API key.
Please check GCM API key that you entered in your Android settings in
the Control Panel. You should try both Browser key and Server key.
For those who encounter this problem, i finally generated a new GCM Api key from google developers console and replaced it with the old one in pushwoosh pannel and it solved my problem and my push notifications were sent successfully from that point. As this question is asked a long time ago, currently if you encountered same problem, create new FCM Api key and replace it.
Related
I have an android application that uses FCM to get notifications.
I'm using this versions:
implementation "com.google.firebase:firebase-analytics-ktx:17.4.3"
implementation "com.google.firebase:firebase-inappmessaging-display-ktx:19.0.7"
implementation "com.google.firebase:firebase-messaging:20.2.0"
The problem that I've encountered recently is that I tried to send push notification with my own backend server via REST API call. I noticed that for every single api call, android devices get notifications twice.
So I've checked this Question: Firebase send push notification twice and I noticed that like Tom Bevelander's answer, I have a third party lib that uses GCM behind and when I removed that lib from project, problem fixed.
So I have to force my users to update the application. but I don't really want this approach. Something that I saw is that on previous version (GCM included app) when I'm testing push notification with Firebase Panel itself, everything works fine and devices get single notification. but with api call, devices get duplicate notifs. What is the difference between this approaches? How can I find out whats happening behind the FirebasePanel? So that I call same api that panel uses itself?
The endpoints that I've tested is this:
https://fcm.googleapis.com/fcm/send
and this:
https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send
brother may shore the device token is maybe duplicate like two users sign in from the same device and both user device token is same and server through a notification on the base of device token .so it throughs notification twice if he found the same token twice or more.
I'm trying to set up the messages module in the QuickBlox SDK. I'm able to register in GCM and send the push according to the logs. The problem is that I never get the push notification.
I tried with the default sample keys and with my own. I tried with server key and browser key and nothing.
Let me know what information you need so we can resolve this :(
In the QB console I get this:
Notification has been successfully added to queue
I tried from the development and production environments and nothing happens.
Is signup for "Upstream Google Cloud Messaging and User Notifications Sign-up" at link "https://services.google.com/fb/forms/gcm/" compulsory to get notification from server app to device?
I have created sample app and sending the sample notification from server. i m getting "OK" response along with message_id, i assume that means my message has been accepted by GCm bit the message is not getting delivered to registered Device? I read somewhere with GCM, registration to the link above is required. I tried that too but i didnt get any response back from google. am i missing anything?
Harshil.
Yes, it is compulsory. When sending a message through GCM, you need to specify a SENDER_ID which is given to you when you create a Project inside, and for this, you have to sign up. So even if you got an OK response, I doubt you specified a correct SENDER_ID so this message probably got discarded.
Maybe this might help:
How to send location of the device on server when needed
As of June 2014, sign-up is no longer required for GCM upstream user notifications (among other features).
There's a post on the Android Developer Blog with more info. Specifically:
At Google I/O we announced the general availability of several GCM
capabilities, including the GCM Cloud Connection Server, User
Notifications, and a new API called Delivery Receipt. This post
highlights the new features and how you can use them in your apps. You
can watch these and other GCM announcements at our I/O
presentation.
I have integrated GCM on client also made its Server side component. Every thing was working fine, I was able to send push notification from server to all the registered client. I am using google App engine as my server.
Problem came when:
I changed the API Key on server.
Earlier I was using my personal GMail account to get API Key and all other access was through my account. Just before pushing the application live I moved the server to Production account and also changed the IDs as per production Ids. By Id I mean API Key, project ID, Production Keystore etc. Now the issue is when I want to send Push notification on Server I am getting URL Exception "HTTP Error 401: Unauthorized"
I tried doing:
- Deleting my older Ids.
- Deleting Old Public API access keys.
The same code works fine if I try to send Push notification from my old Server.
Does it has something to do with : Project package name and API key... which gets registered once can only be used....If yes How to delete that without changing the client project package name.
Please help we cannot go live with Old Server.
Check if ports 5228-5230(GCM ports) are open in the new server. It could be the problem.
The issue can be beacause you are using the old server api key for the new server as well. For sending the push notification from server side, you need the api key generated with the help of server's public IP address.
If it is testing purposes, make sure your server API key on the google console has the relevant ip addresses in the whitelist:
0.0.0.0/0
::/0
These are for ipv4 and ipv6 ips
Since this is an older question that was never answered but still gets views, I'll post here that this issue may have been obsoleted as the Cloud Console has gone through a couple of iterations since then.
Also, Google Cloud Messaging has been superseded by Firebase Cloud Messaging. New projects should use FCM, and existing projects are encouraged to upgrade in order to benefit from new features.
Firebase Cloud Messaging
https://firebase.google.com/docs/cloud-messaging/
I am using Google Cloud Messaging in my application. I am facing this issue. some times i am getting push notifications earlier and sometimes i am not getting even single message also.on that time i am switching the wireless or mobile internet data on and off than the notification are coming..
how to get notifications fast from Google Cloud Messaging server....
please any help me with u suggestions....
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
Yes its depends completely on the gcm servers. Basically what happens is when you create google api key(gcm key, you tube api key etc ) at google api console it takes time to propogate to all the servers i.e the server where you have created the api key and the server which your using push gcm notifications are different.So at starting you will face some issue, after words it works smoothly.