failed gcm registration in android - android

I'm trying to deploy an application with push notifications. The problem is that I can not get it to work from a device. While using the emulator, everything is ok but when using a cell phone I get a log saying "AUTHENTICATION_FAILED".
I have checked and the Gmail account is synchronized but is always trying to check me out this error.
Could someone give me a hand?

This is occurred due to the bad Google Account password. Check your account on the phone.
Bad Google Account password. The Android application should ask the
user to enter his/her Google Account password, and let the user retry
manually later. Fix on the device side.
Check error codes and explanations here.

The problem was that I had multiple accounts on the phone, for those who have the same problem only has to synchronize with an initial account set up the phone.

In my case I face this problem due to a firewall on the network which blocked URLs and ports of GCM. I solve it temporarily by using a VPN service i.e. Hotspot.
To solve permanently I allowed following ports and URLs on firewall.
5228
5229
5230
All IPs which are listed in Google's ASN of 15169

Related

Google Cloud Messaging IP address

I have made an android application with GCM enabled service in it which works on localhost. User needs to register in order save the device id in the database which would help administrator to send push notifications to the user. Since, the database is on localhost, registration works fine on emulator. But after installing the app on phone, the device does not get registered. Due to unsuccessful registration, the details do not get entered into the database. After searching a bit, found out the problem as the ip address. IP address on pc is different than the address taken by phone even via same router. Is there any solution for this problem? I really need to run the app on the phone and not just on emulator. Thanks in advance!

WSO2 EMM Android Agent App Issue 'Connection Failed'

I have installed the latest version of the WSO2 EMM v1.1.0. Followed all of the Installing, Deployment, and Running documentation.
The server is up and running, I added my Gmail info into the setting in the EMM console so I can send out invites. I added a user and sent an invite. It is received by the client phone (connected on the same LAN as the server). The app can be downloaded. I put in the server IP address, the users email and the password given in the email.
When I hit the 'Register' button I get this prompt, "'Connection Failed' Server is unavailable. Please contact administrator."
I have done two clean installs of the WSO2 EMM software, re-imputed the IP address in the Android client app, and have actually tried both "HTTP ; 9763" and "HTTPS ; 9443" within the CommonUtilities class.
I am at a loss as what to try next, any help would be much appreciated thank you.
Is your android phone and your server connected to the same network connection? If so, can you connect your android phone to your PC which has eclipse (with android sdk configured) and let me know what is displayed in the logcat when you hit the 'Register' button.
You have to login to EMM app atleast once before doing a device enrollment. This could be due to APIs being not published to the API store we have embedded in the EMM server. Check on the following path https://{server_domain}:9443/productapistore. Check whether there exist any published APIs. Also check your connection. Check whether you can access the EMM app through your mobile browser.

IP range of google GCM push notification server?

Wonder if anyone here happen to know the ip range of google's gcm server (for android push notification)?
I need the information so that our network team can open the firewall port for our UAT environment for incoming UAT test.
I tried to lookup from developer.android.com/google/gcm/‎ but no luck.
Our network team refused to open all ip range from asn 15169 which is a rather huge list.
I think there is an existing question IP address for Google Cloud Messaging server and the person found out that those are not published by Google. I also tried to look for it once but couldn't find. I might be wrong but I am pretty sure they don't publish that. Maybe instead of using corporate wifi, you can use direct 3G or 4G data plan.
In a comment on why GCM is not giving push notification in android device? question someone has mentioned that He opened the ports 5258,29,30 and then he was able to receive the regId from GCM server behind firewall.
Also I think the answer by #Eran on Which port and protocol does Google Cloud Messaging (GCM) use? will be of help. It says:
The device accesses the GCM servers on ports 5228-5230. If your organization has a firewall that restricts the traffic to or from the Internet, you'll need to configure it to allow connectivity with GCM. The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230. GCM doesn't provide specific IPs. It changes IPs frequently. We recommend against using ACLs but if you must use them, take a broad approach such as the method suggested in this support link.
This is relevant if your device is connected to the internet via WiFi.
Hope this helps a bit.
Update:
As per Mark Whitaker answer to a similar question here, he mentions that:
Newer versions of Android also fall back to port 443 if ports 5228-5230 are blocked by a firewall.
Although there doesn't seem to be an official list still.
To add to what Shobhit Puri already said, I've also tried to find the answer to this question to be able to poke the appropriate holes in my firewall and am extremely disappointed with Google after concluding that the IP address used for Google Cloud Messaging is not obtained using a DNS request, or are obtained using DNS requests that subvert the Always On VPN functionality in Android.
By using the Always On VPN function in later versions of Android, I made sure that all traffic went through one of my servers. This also allowed me to use that server as a DNS Resolver and by activating query logging and rebooting the phone I was able to get a list of all of the DNS requests that it makes. Then, with some scripting magic I checked all of them, but none of them resolved to the IP address(es) that show up in my firewall logs with outbound port 5228 drops.
This leads me to conclude that the IP addresses used for GCM are obtained using a method other than DNS, such as Google Play Store web traffic.
Edit (Solution?): After running a script through all of my firewall logs going back as far as I have them and pulling out all of the dstport 5228 entries, I've been able to compile a list of IP addresses that GCM has tried to connect to. I can't say that this is a complete list, it will likely change based on geographic location, but notice the pattern...
74.125.28.188
74.125.129.188
74.125.20.188
173.194.79.188
74.125.142.188
74.125.192.188
74.125.140.188
74.125.139.188
74.125.137.188
74.125.134.188
74.125.130.188
173.194.68.188
173.194.76.188
I've created a group for all of those IP addresses and have configured my firewall to use that for my GCM whitelist. I have also setup a report to check for any dstport 5228 drops to let me know if I ever need to revisit this.

Android GCM Unauthorized 401 error with PHP

Recently my GCM push message notification didn't work anymore.
I didn't change anything, in my Google API Console, I've registred the IPV6 of my dedicated server if the whitelist IP address.
But when I try to reach GCM service I always get an error :
Unauthorized
Error 401
Also tried with IPV4 without success...
I've tried the same script on my own computer and everything works smooth ...
Any idea would be very appreciate :)
Thanks for your help
You need to put the server IP address in the whitelist ip addresses in google api console for GCM.
Edit:
you must use Key for server apps (with IP locking) instead of browser key.
i have had the same issue for 1 whole day ! but silly me...
in your Dev console>APIs & auth > make sure your "google cloud messaging for android" is ON !
That was my mistake.
And also first test by allowing all IPs.
I had the same issue. What resolved it for me was registering my public ip, waiting for a few minutes and then refreshing the google api console page.
I had the same problem and ended up adding "0::0/0" to my whitelist ip addresses. This fixed the problem for me. Though a better solution would be to get a real IPV6 to use for the server.

Unable to connect to Google API from server (401: Unauthorized)

I've migrated a web application that sends push notifications to Android apps using Google Cloud Messaging from my local workstation to a server.
Connecting to https://android.googleapis.com/gcm/send worked perfectly from my workstation. My list of allowed IPs in my Google API project includes my server's IP (and I've triple checked it), but when I connect using the exact same API key from the server, I am always getting a 401 (unauthorized) response back from Google.
I am connecting from a Linode VPS, and when I wget the same URL, I can see that it is going over IPV6. I've copied my server's IPV6 address from http://whatismyv6.com/ and also included that in the list of allowed IPs, but still I'm still only getting 401 responses.
My guess is it's related to IPV6, so I'll go ahead and try to force connecting over IPV4- but I'm curious about whether anyone else has experienced this.
Interesting. It suddenly just started working. Out of curiosity, I removed my IPV6 address, tried again and it failed. Then after adding it back, it failed a few times before started working again.
It seems that it may just take a little while for Google to accept the IPV6 address?
I guess I'll leave this question / answer though, in case anyone else experiences it. Make sure your server's IPV6 address is in the allowed list, then just go refill your coffee and try again later.

Categories

Resources