0

I want to use GCM for my project and so i create a project at google console and wanted to add an api key. Now i have different options:

  1. Server Key
  2. Browser Key
  3. Android Key
  4. iOS Key

What i actually want to do is sending GCM Messages from my Apache Server using PHP to my Android devices. So which kind of key do i need now? The Server Key? The Browser Key or the Android Key?

I know that all i need at my Android Client side is the SENDER_ID which is the id of my project. I just need the API key serverside.

Mulgard
  • 9,877
  • 34
  • 129
  • 232
  • you need `Server Key` for your php side. – Kathi Mar 26 '16 at 14:27
  • So the android key is only if i want to send a gcm message from my android device to somewhere? – Mulgard Mar 26 '16 at 14:30
  • You dnt need of android key to send message. you only require `serverkey` and `register key` which you will get after u register you device with GCM server(by calling `register()`) – Kathi Mar 26 '16 at 14:33

2 Answers2

1

You need the Server Key. Using it you can send push notifications to Android Devices using cURL in PHP.

Eric B.
  • 4,622
  • 2
  • 18
  • 33
1

Check official web site: Setting up API keys

ugur
  • 3,604
  • 3
  • 26
  • 57
  • Thank you. But it is still confusing because they write "Use this key if your application runs on Android" and "Use this key if your application runs on a Server" they dont mention where the gcm is sended from and thats the important part. because from my logical way of thinking i have an application for the server AND for android. So which key to use is still the question after reading the official website. – Mulgard Mar 26 '16 at 15:05
  • you re right. here they tell to use server api key: https://developers.google.com/cloud-messaging/android/start "Also, copy the Server API key. Before running the app, you'll need to add this as the value of API_KEY in GcmSender.java." – ugur Mar 26 '16 at 15:20