0

I'm a PHP developer and I have this assignment where I have to send GCM messages to an android application.

I have zero experience on developing android applications so I would like to know if there's a sandbox or a test application where I can test if my server is working properly.

I'm creating the server with these instructions: GCM with PHP (Google Cloud Messaging)

It seems that I need a server api key (which I know how to create in the google developer console) but how can I create a blank application? I need exact tutorial since I know nothing about it.

I found this answer earlier: https://stackoverflow.com/a/12437549/1278155 but I have no idea what to do with the .zip file provided.

Community
  • 1
  • 1
sleepless_in_seattle
  • 1,912
  • 2
  • 20
  • 33
  • http://code.google.com/p/gcm/source/browse/gcm-client/GcmClient/#GcmClient%2Fsrc%2Fmain – Eran Jul 18 '14 at 10:21
  • See http://stackoverflow.com/questions/22168819/android-test-push-notification-online for a simple PHP script that will send a notification to an app. Might give you some ideas. – Kristopher Johnson Oct 20 '14 at 18:34

1 Answers1

1

1

You need to register the App on Google Console. For this you need following information about the application to which you wish to send notifications:

  1. SHA Certificate : This is a key that uniquely identifies the Machine on which the app is being created and the app itself. There is a Command Prompt command to get this key directly.

  2. Package name : Each application has a unique Package Name as you have a URL for PHP projects.

The app developer can provide with these details. Then on successful app registration you will get ProjectCode and a Key. These will be needed in further process

2

Next to go a bit deeper and explain why all this information is required by GCM, you see on device side, the app needs to register the user with GCM and in return it gets a GCM-ID at run time. Then This GCM-ID received is passed on to the server side(You). The developer will need ProjectID and Key that was generated in #1.

3

Now when you trigger your code to fire a GCM, you mention the GCM-IDs to send the notification to specific devices or else you can mention the ProjectID that you receive at the time of app registration with Google Console. These parameters are handed over to Google's Side of things.

4

Now if you pass ProjectID, Google can fetch all corresponding GCM-IDs to this project-ID or else you have specifically passed some GCM-IDs. Then the Google will push a message to all devices corresponding to the GCM-IDs.

5

Still not over, The message reached the target device, but not the target Application on the device. So for this purpose we need the package name at the time of registeration o Google console.

Community
  • 1
  • 1
Parth Kapoor
  • 1,389
  • 9
  • 22