What are exactly server-key, android-key, and browser-key?

1,546 views
Skip to first unread message

s-91

unread,
Feb 5, 2014, 4:39:28 AM2/5/14
to andro...@googlegroups.com
Hi have just started working on GCM.

I followed the document at http://docs.ishome.org/android/google/gcm/gcm.html.
1. Created Google project.
2. Created an android-key (As per the document).
3. Setup the gcm-demo-server, gcm-client provided by Google. Tried to get notification . But I get 'UnAUTHORIZED' error.
4. When I changed the API -key that I configured in gcm-demo-server to a new server key, (rather than android key), it started working.

What is it exactly that we need to provide server-key or android key for GCM? How do they differ?

Please help me understand.

Thanks!

s-91

unread,
Feb 5, 2014, 4:57:10 AM2/5/14
to andro...@googlegroups.com
Also, I have a server-key using which I could send push notification. But later, when  I used different server-key which has same public IP address allowed for the same Google API Console project, I get 'UNAUTHORIZED' error.

Can we have multiple API keys for one Console project? What is the exact IP address that we should be providing while creating server-key?

Andrew Westberg

unread,
Feb 7, 2014, 2:19:00 PM2/7/14
to andro...@googlegroups.com
You want to use the server's public ip address (or range of server ip addresses) when setting this up. From the server you can hit http://www.whatsmyip.org/ to find out what your public ip address is.  Let's say it's 40.30.20.10.

When you create your server key, you need to create an ip address for what servers you want to allow.  For example, if you wanted to ONLY be able to send GCM messages from that one server, you'd set it to: 40.30.20.10/32.  The /32 tells it to match all 4 parts of the IP address when determining if the server is allowed to send. If you wanted to only match 40.30.20.*, then you'd use /24. 40.30.*.* would need to be /16 and matching anything 40.*.*.* would need /8. Basically, you're telling it how many bits of the IP address to match.

-Andrew

s-91

unread,
Feb 20, 2014, 6:05:53 AM2/20/14
to andro...@googlegroups.com
Hi Andrew, thanks for your answer..  that was helpful.
Also, I think documentation is now updated and tells that we need server-key  for sending push notification. :)

Liza Jenifer

unread,
Mar 1, 2014, 9:09:27 AM3/1/14
to andro...@googlegroups.com
I have read you post which is very informative for me. I think this good
approach by you. I really need this post, You have great collection.
But i also need server key for sending push notifications.
_______________________________________________
Android Tablet PC | Android Tablet

s-91

unread,
Jun 6, 2014, 12:05:04 AM6/6/14
to andro...@googlegroups.com
One more thing I would like to know , as I mentioned earlier, is , Can we have multiple server keys for a sender ID (i.e. console project)?

Sakis Kaliakoudas

unread,
Jul 12, 2015, 8:17:46 PM7/12/15
to andro...@googlegroups.com
Quick question on the IP. Is this feature enabled? I've tried using a random IP address and my server still starts up and processes messages just fine.

Diego Giorgini

unread,
Jul 14, 2015, 12:30:24 AM7/14/15
to andro...@googlegroups.com
Hi Sakis,

On Sun, Jul 12, 2015 at 5:17 PM Sakis Kaliakoudas <sendm...@gmail.com> wrote:
Quick question on the IP. Is this feature enabled? I've tried using a random IP address and my server still starts up and processes messages just fine.

This feature is enabled for the HTTP API.
Which API are you using?
 
Best regards,
- Diego

Sakis Kaliakoudas

unread,
Jul 15, 2015, 7:45:42 AM7/15/15
to andro...@googlegroups.com
Hello,

thanks for clearing this up. I am ussing XMPP. So this has no effect whatsoever. I take it I should just leave it blank ?

Cheers,
Sakis
Reply all
Reply to author
Forward
0 new messages