calonso / rails-push-notifications Goto Github PK
View Code? Open in Web Editor NEWRails iOS, Android and Windows Phone Push Notifications made easy!!
Home Page: https://rubygems.org/gems/rails-push-notifications
License: MIT License
Rails iOS, Android and Windows Phone Push Notifications made easy!!
Home Page: https://rubygems.org/gems/rails-push-notifications
License: MIT License
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
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?
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>
Hi, can I change the badge# on Android, I tried to pass the badge attribute but in the notification but nothing happened.
if yes, how should I implement it with firebase cloud messaging? or its outdated? im using rails 5. thanks in advance..
"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:"
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.
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]
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.
Hello,
I need to send push notifications for voip applications to start a call. Does it support pushkit? is there any WO to do it?
Thanks in advance
Hello.
Just lost few hours.
The data object for GCM is not using "text" key but "message".
Hope it will help.
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.
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.
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.
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
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.
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>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.