Giter Site home page Giter Site logo

calonso / rails-push-notifications Goto Github PK

View Code? Open in Web Editor NEW
138.0 138.0 44.0 107 KB

Rails iOS, Android and Windows Phone Push Notifications made easy!!

Home Page: https://rubygems.org/gems/rails-push-notifications

License: MIT License

Ruby 100.00%

rails-push-notifications's People

Contributors

arnaudremi avatar calonso 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  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  avatar

rails-push-notifications's Issues

Send additional data using this gem

How can you send additonal data like these:

{
  "to": "<token>",
  "time_to_live": 86400,
  "collapse_key": "new_message",
  "delay_while_idle": false,
  "notification": {
    "title": "title",
    "body": "this is a noisy test",
    "tag": "new_message",
    "icon": "new_message",
    "color": "#18d821",
    "sound": "default"
  }
}

using your gem?
Thanks

APNv2

What I like about this gem is that it targets both Apple and Android platforms in one place.

Seeing as Apple rolled out and now recommends HTTP/2 based APNv2 and Google now recommends Firebase, I'm curious if there's a timeline for supporting these developments?

Unauthorized Error 401

I get the following error when trying to push the notifications:

RubyPushNotifications::GCM::GCMAuthError: <HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

Update Badge number on Android

Hi, can I change the badge# on Android, I tried to pass the badge attribute but in the notification but nothing happened.

this gem works with FCM?

if yes, how should I implement it with firebase cloud messaging? or its outdated? im using rails 5. thanks in advance..

Typo in docs under apple application setup

"To convert the certificates the first you need is to export them as .p12 files. To do this:"

Should be:

""To convert the certificates the first thing you need to do is to export them as .p12 files. To do this:"

Errno::ECONNRESET PushNotificationController -- Connection reset by peer

I am getting "Connection reset by peer" since yesterday and not able to push notifications on apns. It was working fine earlier, don't know how to solve the error.
Confirmed certificates being used are proper and active.
I am using OpenSSL 1.0.1k-fips, ruby 2.2.1p85, gem 2.4.8, Rails 4.2.4. please suggest what could be the issue.

Migration files in Rails 5 wont migrate

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateRailsPushNotificationsApps < ActiveRecord::Migration[4.2]
C:/Users/micha/Documents/WebDev/sms/db/migrate/20180611231832_create_rails_push_notifications_apps.rb:1:in `<top (required)>'

Caused by:
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateRailsPushNotificationsApps < ActiveRecord::Migration[4.2]
C:/Users/micha/Documents/WebDev/sms/db/migrate/20180611231832_create_rails_push_notifications_apps.rb:1:in `<top (required)>'
Tasks: TOP => db:migrate

The fix is to specify the version in the inheritance signature:
class CreateRailsPushNotificationsApps < ActiveRecord::Migration[5.0]
and
class CreateRailsPushNotificationsNotifications < ActiveRecord::Migration[5.0]

Unable to set sender_id for GCM

When calling app.push_notifications I get an response error complaining about a mismatch sender id. @results=[#<RubyPushNotifications::GCM::GCMResultError:0x007fdd001805d0 @error="MismatchSenderId">]>,. From the documentation there doesn't seen to be a way to set this.

Data for GCM is not text

Hello.

Just lost few hours.
The data object for GCM is not using "text" key but "message".

Hope it will help.

Mulitple Notifications for the same notification

Thank you for your awesome gem !

When calling app.push_notifications, I get a response success and it works perfectly
However, i receive the same notification several Times on iPhone ( not on android and Windows Phone )

First One => 1 seconde after sending the notification
Second one => 1.5 secondes later
Third one => 1.7 secondes later
...
...
I am using ruby 2.2.1p85, Rails 4.1.0 please suggest what could be the issue.

How to handle badge count for multiple destinations

Hi You created awesome gem but in your gem and in APNS code

app =
notification = app.notifications.create(
destinations: [
'Your first destination token',
'Your second destination token'
],
data: { aps: { alert: 'Hello APNS World!', sound: 'true', badge: 1 } }
)

you are sending badge 1 for all destinations but if some one wants to send different badge count for different destinations. How did you handle this scenario.

No text in the notification

Insertion
=> [#<RailsPushNotifications::Notification:0x007f1a15c33878 id: 7, destinations: ["ciJie4Om2aw:APA91bHckWobcMLNzOXxe9eXl0X4FuoDym9IlcBjvWOiwjtq0LptHEdy0ubgUahqb-79TF6X5J9eUUL-TRo3jACQBGmL1vPhP9cSb2TXnVCAU-iIlvQc1Kps-Yg0aUiVhjXZHBAq04Po"], app_id: 7, app_type: "RailsPushNotifications::GCMApp", data: {:text=>"Awesome bags is in Live In near you"}, results: #<RubyPushNotifications::GCM::GCMResponse:0x007f1a15824098 @canonical_ids=0, @failed=0, @results=[#<RubyPushNotifications::GCM::GCMResultOK:0x007f1a154037c0>], @success=1>, success: 1, failed: 0, sent: true, created_at: Thu, 28 Jul 2016 09:50:22 UTC +00:00, updated_at: Thu, 28 Jul 2016 09:50:22 UTC +00:00>]

Notification is receiving but no text is showing in the notification.

PFA.
screenshot_2016-07-28-15-35-42

Which fields are available?

Hello,
I'm testing this gem with GCM, using on the device the GCM QuickStart, in the notification created I use, as data an hash like this:

data: { message: self.title }

It correctly sends the notification, which is displayed on the android device, I was looking for a way to set the title and the icon, but can't seem to find one, I tried something like:

data: { title: "This Title", message: self.title }

but it just shows the message? What am I missing?

thank you for the answer,
Gabriele

Notifications not received when app is closed

Hello,

I am trying to send notifications to android device. When app is open in my device, i am getting push notification, but its closed there is no notifications receiving. Here is the code which i am doing:

notification = app.notifications.build(
    destinations: [DEVICE_TOKEN_HERE],
    data: { text: message, key: value, key: value }
  )
  app.push_notifications if notification.save

where key are the extra parameters i want to pass. This code works when the app is opened. Is there anything wrong in the code ? or do i need to add some other settings to receive the notification when app is closed? Your kind help is highly appreciated.

Thanks in advance.

Rails 4 support

Do you think to provide rails 4 support for this gem?

Recently i tried to include your gem in a project and i got the following trace error when i run

rails g ror_push_notifications:migrations
/Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.7/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `attr_accessible' for #<Class:0x007fbf2a1461a8> (NoMethodError)
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications/app/models/rpn/apns_config.rb:9:in `<class:ApnsConfig>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications/app/models/rpn/apns_config.rb:1:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/bundler/gems/ror-push-notifications-4aea09c92ffd/lib/ror_push_notifications.rb:2:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:76:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:72:in `each'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:61:in `each'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler/runtime.rb:61:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.13/lib/bundler.rb:134:in `require'
    from /Users/carlosleon/sources/solid-finger/config/application.rb:7:in `<top (required)>'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:82:in `require'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:82:in `preload'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:143:in `serve'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:131:in `block in run'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:125:in `loop'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application.rb:125:in `run'
    from /Users/carlosleon/.rvm/gems/ruby-2.2.0/gems/spring-1.3.2/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/carlosleon/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

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.