Giter Site home page Giter Site logo

gcm_on_rails's Introduction

Gcm on Rails (Google Cloud Messaging for Android on Rails)

Gcm on Rails (gcm_on_rails) is a Ruby on Rails gem that allows you to easily incorporate Google’s ‘Google Cloud Messaging for Android’ into your Rails application. This gem was derived from c2dm_on_rails (https://github.com/pimeys/c2dm_on_rails) after Google deprecated C2DM on June 27, 2012

Acknowledgements:

This gem was derived from Julius de Bruijn’s gem c2dm_on_rails which according to him, was originally a rewrite of the gem
apn_on_rails written by Mark Bates and before him Fabien Penso and Sam Soffes. Thanks to all the above who were involved in
earlier versions or derivatives of the gem. I originally wanted to use the c2dm_on_rails gem for a project at Kopo Kopo, Inc
and the rug was pulled from under me when Google deprecated C2DM in favor of GCM (Google Cloud Messaging). I thus decided to
create an updated gem. This is also my first rubygem so please feel free to fix or add on anything you may see fit.

Requirements:

You will have to sign up to GCM first via the Google APIs Console page (https://code.google.com/apis/console).
When you create an new API project, the browser url will change to something like:


https://code.google.com/apis/console/#project:4815162342

The value after #project (4815162342) in this example is the project ID and will be used later on as the GCM sender
ID. You will also need to obtain an Api Key and for detailed instructions on how to get one, follow the instructions
here:-

http://developer.android.com/guide/google/gcm/gs.html

GCM is designed to work on Android version 2.2 or greater, so only Android 2.2> devices are eligible. The device must
also have an active Google Account if the Android version is less than version 4.1

Installing:

Installation is by simply adding the following to your Gemfile:


   gem 'gcm_on_rails'

Setup and Configuration

The following needs to be added to your Rakefile so that you can use the the Rake tasks that ship with gcm_on_rails:


  begin
    require 'gcm_on_rails_tasks'
  rescue MissingSourceFile => e
    puts e.message
  end

To create the tables needed for Gcm on Rails, run the following task:


  $ rails generate gcm_migrations

Gcm on Rails like its predecessor uses the Configatron gem, http://github.com/markbates/configatron/tree/master,
Some settings need to be loaded for configuration purposes. An initialzer script that can be put in config/initializers/gcm_on_rails.rb
will suffice. Below is an example of such a script.


configatron.gcm_on_rails.api_url = 'https://android.googleapis.com/gcm/send'
configatron.gcm_on_rails.api_key = 'AAAAAAPPPPPPPIIIIIIIKKKKKEEEEYYYYY'
configatron.gcm_on_rails.app_name = 'com.yourapppackage.com'
configatron.gcm_on_rails.delivery_format = 'json'

A couple of notes:
- The api_key is the api key that you received from Google when signing up for GCM
- Note that unlike the old C2dm on Rails, GCM on Rails switches to a simple API key for authentication. ClientLogin or OAuth2 tokens will NOT work.
- The app_name is simply the name of the pacakge of your Android app.
- GCM on Rails message requests can be either be sent in plain text or JSON format. Specify ‘json’ for JSON and ‘plain_text’ for plain text format.

That’s it, you are now ready to start creating notifications.

Upgrade Notes:

When upgrading to a new version of Gcm on Rails, you should alwasy run:


  $ rails generate gcm_migrations

That way you are ensured to have the latest version of the database tables needed.

Example:

Please note that a more detailed introduction to GCM is located at http://developer.android.com/guide/google/gcm/index.html


  $ rails console
  >> device = Gcm::Device.create(:registration_id => "XXXXXXXXXXXXXXXXXXXXXX")
  >> notification = Gcm::Notification.new
  >> notification.device = device
  >> notification.collapse_key = "updates_available"
  >> notification.delay_while_idle = true
  >> notification.data = {:registration_ids => ["RegistrationID"], :data => {:message_text => "Get on cloud nine"}}
  >> notification.save

The following Rake task can then be used to deliver notifications:


  $ rake gcm:notifications:deliver

The rake task will look for any unsent notifications in the database. If found, the notifications will then be dispatched
for delivery. If no unsent notifications exist, the Rake task simply does nothing. As described by Google, possible errors
from the GCM servers are:

Code 200
Error: MissingRegistration. Happens when the request did not actually contain a registration_id parameter when in plain text format or registration_ids when in json format.
Error: InvalidRegistration. The registration_id passed is not on the GCM servers. The device and all of its notifications will be deleted.
Error: MismatchedSenderId. The sender Id that was passed is not one that the application specified as an allowed sender.
Error: NotRegistered. An existing registration Id has ceased to be valid. The device and all of tis notifications will be deleted.
Error: MessageTooBig. The total payload data that is in the message exceeds 4096 bytes.
Code 401
API Key is Invalid. Check the configuration file
Code 503
Service is unavailable and you should retry later. However, you must honor the ‘Retry-After’ header if it is included in the response from the GCM server.
Exponential backoff should be implemented in your retry mechanism.
Code 500
Internal server error. Retry again while still honoring ‘Retry-After’ header and using exponential backoff.

To-Do’s:

- For some reason Gcm servers sometimes return a status code 200 with a nil ‘message’ key in the json returned but the
message is still sent successfully. For version 0.1.3 a nil check has been introduced to check if the message key in the json
is nil. The issue that still exists, is that if the message is nil we have no way of knowing if the message was successfully sent
just by going by the http status code 200 because HTTP status code 200 could still mean that the errors mentioned above could have
occurred. So I still consider this as temporary ‘hack’ until someone figures out why the Gcm servers may be sometimes sending nil
in the message object of the return json.

- Tests, tests then some more tests. These need to be implemented.
- Implement “broadcasting” sending and processing responses to multiple registration id’s within one request. Currently only one message to a single registration id is implemented.

Released under the MIT license.
Copyright © 2012 Dennis Ondeng. See LICENSE.txt for further details.

gcm_on_rails's People

Contributors

cwperry avatar dondeng avatar jitesh-dedhiya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gcm_on_rails's Issues

Doesn't work with Mongoid

I am trying to use gcm_on_rails that doesn't use Activerecord, on startup I get this error:

`module:Gcm': uninitialized constant Gcm::ActiveRecord (NameError)

After run rails generate gcm_migrations command ----->next_migration_number': NotImplementedError (NotImplementedError)

I am using rails 4.2.1
Ruby 2.2.1p85

/home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/generators/migration.rb:29:in next_migration_number': NotImplementedError (NotImplementedError) from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/generators/migration.rb:41:inset_migration_assigns!'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/generators/migration.rb:57:in migration_template' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/gcm_on_rails-0.1.3/lib/generators/gcm_migrations_generator.rb:26:inblock in create_migrations'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/gcm_on_rails-0.1.3/lib/generators/gcm_migrations_generator.rb:24:in each_pair' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/gcm_on_rails-0.1.3/lib/generators/gcm_migrations_generator.rb:24:increate_migrations'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/invocation.rb:133:ineach'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/invocation.rb:133:ininvoke_all'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/generators.rb:157:in invoke' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands/generate.rb:13:in<top (required)>'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in require' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:inblock in require'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in load_dependency' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:inrequire'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:123:in require_command!' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:130:ingenerate_or_destroy'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:50:in generate' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:inrequire'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in block in require' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:inload_dependency'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in require' from /var/www/html/preitmessage/releases/20151103031417/bin/rails:8:in<top (required)>'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in load' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inblock in load'
from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in load_dependency' from /home/daffolap-198/.rvm/gems/ruby-2.2.1@preitmessage/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inload'
from /home/daffolap-198/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /home/daffolap-198/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from -e:1:in `

'

How to "touch" last_registered_at ?

"In order for the Gcm::Feedback system to work properly you MUST
touch the last_registered_at column every time someone opens
your application. If you do not, then it is possible, and probably likely,
that their device will be removed and will no longer receive notifications."

How can I do this, if the attribute is not accessible and the set_last_registered_at method is private?

Thanks,
Daniel

Message text includes the Sender Id

The notification message text includes the Sender ID and Collapse Key. Is it possible to eliminate this information from the message text so the recipient does not see it?

Gcm::Notification.send_notifications throwing the the error TypeError: can't convert nil into String

I setup the GCM gem as shown in the readme file every thing went ok but when am trying to send the notification application throwing the following error and it happened in both the case if i try Gcm::Notification.send_notifications or try running the rake gcm:notifications:deliver

Error log:
TypeError: can't convert nil into String
from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/json-1.6.3/lib/json/common.rb:148:in initialize' from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/json-1.6.3/lib/json/common.rb:148:innew'
from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/json-1.6.3/lib/json/common.rb:148:in parse' from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/bundler/gems/gcm_on_rails-e00ff3a71bc5/lib/gcm_on_rails/app/models/gcm/notification.rb:42:inblock in send_notifications'
from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/bundler/gems/gcm_on_rails-e00ff3a71bc5/lib/gcm_on_rails/app/models/gcm/notification.rb:35:in each' from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/bundler/gems/gcm_on_rails-e00ff3a71bc5/lib/gcm_on_rails/app/models/gcm/notification.rb:35:insend_notifications'
from (irb):9
from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in start' from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/railties-3.1.3/lib/rails/commands/console.rb:8:instart'
from /home/pravin/.rvm/gems/ruby-1.9.3-p125@family_tracker/gems/railties-3.1.3/lib/rails/commands.rb:40:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Android push notification is not working..

I am using this gem for sending push notification on android device (application users). This was working fine till 31st of december 2014 with response code(response = {:code=>200, :message=>nil}) after that this the notifications are not delivering to the user but I can see notifications on console.

ruby => ruby-1.9.3-p429
rails => rails', '3.2.14'
gem => gcm_on_rails

response = {:code=>200, :message=>nil}

Please help me and let me know that what is the issue with it.

Notifications - Device association

Assuming the notification sender is always the rails application..

I don't understand why the notification only belongs_to :device instead of has_and_belongs_to_many :devices.

Adding this relation will allow to automatically generate the appropriate json to send to GCM in order to send one notification to multiple devices (instead of adding each registration_id "manually").

What do you think? Is there a reason why the notification is associated to only one device?

[Question] {:code=>200, :message=>nil} problem ??

When I attempt request push message at the GCM Server using "Gcm::Notification.send_notifications", I alway got a response hash data contained ":message => nil". (status code is 200, and push message was sent normally in device)
In normally, successful response data take a below form
{:message=>"{"multicast_id":6085691036338669615,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1349723376618187%d702725e98d39af3"}]}", :code=>200}
But my response data is not..
What's the problem??

To help understand, attach part of my source code

def send_msg
  regid = params[:regId]
  notification = Gcm::Notification.new
  device = Gcm::Device.where(:registration_id => regid).first
  p "[send_msg] device info = #{device.inspect}"
  notification.device = device
  notification.collapse_key = params[:collapse_key]
  notification.delay_while_idle = params[:delay_while_idle]
  notification.data = {:registration_ids => [regid], :data => {:message => params[:message]}}
  p "[send_msg] notification info = #{notification.inspect}"
  notification.save
  Gcm::Notification.send_notifications
end

How to Use Default Sender ID

I have some notifications that are sent to users, but not triggered by a user. I entered my own registration id for the sender id of these notifications, sometimes the gcm gem deletes my device id and thus causes an error.

Any solutions to this problem?
Thanks!

Error caused by reduce in connection file while using the documentation example

I've followed the steps but I keep getting an error that reduce can not be applied to String

here is the beginning of the stack trace:

notification = #<Gcm::Notification id: 5, device_id: 1, collapse_key: "hellooo", data: {:registration_ids=>["RegistrationID"], :data=>{:message_text=>"Get on cloud nine"}}, delay_while_idle: true, sent_at: nil, time_to_live: nil, created_at: "2013-01-30 15:25:15", updated_at: "2013-01-30 15:25:15">
NoMethodError: undefined method reduce' for "&data.message_text=Get%20on%20cloud%20nine":String from /home/menisy/.rvm/gems/ruby-1.9.3-p194/gems/gcm_on_rails-0.1.3/lib/gcm_on_rails/libs/connection.rb:20:inblock in send_notification'
from /home/menisy/.rvm/gems/ruby-1.9.3-p194/gems/gcm_on_rails-0.1.3/lib/gcm_on_rails/libs/connection.rb:20:in each' from /home/menisy/.rvm/gems/ruby-1.9.3-p194/gems/gcm_on_rails-0.1.3/lib/gcm_on_rails/libs/connection.rb:20:inmap'

rake aborted! Don't know how to build task 'rails_env'

When I run rake db:migrate I am getting this error. I have recently added gcm_on_rails after this only I am getting the error. My Machine Mac OX, Ruby 1.9.2 and Rails 3.2.1. I am getting the same error in Centos server also. Please help

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
rake aborted!
   Don't know how to build task 'rails_env'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:60:in `lookup_prerequisite'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:56:in `block in prerequisite_tasks'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:56:in `collect'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:56:in `prerequisite_tasks'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
  /Users/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
  /Users/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
  /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `load'
   /Users/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `<main>'
   Tasks: TOP => db:migrate => db:load_config

In config/initializers/gcm_on_rails.rb I have

      configatron.gcm_on_rails.api_url = 'https://android.googleapis.com/gcm/send'
      configatron.gcm_on_rails.api_key = 'XXXXXXXXX'
      configatron.gcm_on_rails.app_name = 'packagename'
      configatron.gcm_on_rails.delivery_format = 'json'

This is the code I used to send notification

      device_token = "12321321312"
      device = Gcm::Device.find_or_create_by_registration_id(:registration_id => "#{device_token}")
      notification = Gcm::Notification.new
      notification.device = device
      notification.collapse_key = "updates_available"
      notification.delay_while_idle = false
      notification.data = {:registration_ids => ["#{device_token}"], :data => {:message_text => "We found a driver for you."}}
      notification.save!
      Gcm::Notification.send_notifications

I was able to run the migration for gcm tables.
But after that when ever I tried to run rake db:migrate I am getting the error.
Is there any thing wrong I am doing while sending the notification to android.

Figure out why HTTP status code 200 still comes with a nil 'message' object from Gcm servers

  • For some reason Gcm servers sometimes return a status code 200 with a nil ‘message’ key in the json returned but the
    message is still sent successfully. For version 0.1.3 a nil check has been introduced to check if the message key in the json
    is nil. The issue that still exists, is that if the message is nil we have no way of knowing if the message was successfully sent
    just by going by the http status code 200 because HTTP status code 200 could still mean that the errors mentioned above could have
    occurred. So I still consider this as temporary ‘hack’ until someone figures out why the Gcm servers may be sometimes sending nil
    in the message object of the return json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.