Caution: Project is very hacky at the moment.
This is just a sample Android application having push notifications. It shows a toast message and notification when it receives the push notification.
The file gcm_server.py can be used to send messages to the application.
- Configure the application in your editor (preferably Eclipse), add libs/gcm.jar to your buildpath
- Change the SENDER_ID attribute in src/com/dhruvb/myapplication/CommonUtilities.java to your Google OAuth project id. Its usually in the URL
https://code.google.com/apis/console/?pli=1#project:<your_project_id_is_this>:access
- Start the application in debug mode, the logcat output will print a device registration id, this id is used by the gcm server to send messages.
- Do a
pip install python-gcm
- Change the API_KEY attribute in gcm-server.py.
- Run the script as
python gcm-server.py -r <registration-id> -m '<message here>'
Refer: https://developer.android.com/google/gcm/gs.html for more clear instructions to get SENDER_ID and API_KEY