Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A gem that helps developers send data from servers to their Android applications on Android devices via Google Cloud Messaging for Android (GCM).
branch: master

This branch is 60 commits behind spacialdb:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
gcm-0.0.2.gem
gcm-0.0.3.gem
gcm.gemspec

README.md

Google Cloud Messaging for Android (GCM)

Build Status

GCM sends notifications to Android devices via GCM.

Installation

$ gem install gcm

Requirements

An Android device running 2.0 or newer and an API key as per GCM getting started guide.

Usage

Sending notifications:

require 'gcm'

gcm = GCM.new(api_key)
registration_ids= ["12", "13"] # an array of one or more client registration IDs
options = {data: {score: "123"}, collapse_key: "updated_score"}
response = gcm.send_notification(registration_ids, options)

Currently response is just a hash containing the response body, headers and status.

If the above code is stored in a file like trigger_gcm.rb, thats how you can call it.

$ ruby -rubygems trigger_gcm.rb

Copyright

  • Copyright (c) 2012 Kashif Rasul and Shoaib Burq. See LICENSE.txt for details.

Thanks

This gem is based on a fork of the older Google push service:

Something went wrong with that request. Please try again.