Skip to content

Instantly share code, notes, and snippets.

@surendrans
Created January 20, 2012 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surendrans/1646309 to your computer and use it in GitHub Desktop.
Save surendrans/1646309 to your computer and use it in GitHub Desktop.
Push Notification to Android Devices Using speedy_c2dm Ruby Client
require 'speedy_c2dm'
require "net/http"
require "net/https"
C2DM_API_EMAIL = "c2dm_registered@gmail.com"
C2DM_API_PASSWORD = "registered email password"
SOME_REGISTRATION_ID ="device_id_registered_to_receive_push_notification"
p "Setting the email and password"
SpeedyC2DM::API.set_account(C2DM_API_EMAIL, C2DM_API_PASSWORD)
options = {
:registration_id => SOME_REGISTRATION_ID,
:message => "Hi!",
:extra_data => nil,
:collapse_key => "some-collapse-key"
}
response = SpeedyC2DM::API.send_notification(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment