(How to implement GCM in your code is very well explained in the official tutorial here).
Our test page will help us easily send GCM messages to a registered device, that way mimicking a server behaviour with very little effort (and without the need to ask the server guy "ok - now try to send a message")
|Our test page for sending messages|
- If you haven't done it so far - start of with the "getting started" guide.
- In the Google developer console --> API's & Auth --> Credentials --> Create a new key:
- Select "key for browser applications"
- Leave the text box emtpy (that will allow all referrers! make sure to use it only in debug)
- The final result will look something like:
- From the device in which you want to receive the message - extract the `registration ID`. The easiest way is to set a log message once the registration is received, or, via the shared preferences after you had it saved.
- Preparing the web page tester -
- Make sure you have a folder that can run PHP scripts
- Download the source code for the test page.
- Open the 'http://localhost/..../gcm_demo.html" and you're good to go!