SlideShare a Scribd company logo
Create Your Own:

Mobile Push-Notification Service

Monday, January 13, 14
Starting Point
• To expedite the tutorial process, I’ve
already created three models:

• User
• Device
• Permitted Apps
Monday, January 13, 14
app/models/user.rb

app/models/device.rb

Monday, January 13, 14
app/models/permitted_app.rb

Permitted App Migration

Monday, January 13, 14
User and Device Migrations

Monday, January 13, 14
Step 2(ish): Routes
config/routes.rb

lib/app_constraints.rb

Monday, January 13, 14
Behold, a versioned API

So, /api/users/ will default to version 1 of our API.

Is this a good idea? There’s a LOT of discussion about versioning APIs...
http://apiux.com/2013/05/14/api-versioning/
https://mathieu.fenniak.net/aint-nobody-got-time-for-that-api-versioning/
http://railscasts.com/episodes/350-rest-api-versioning
Do what feels comfortable / correct. I’m not too keen on having a default API route which may change behind-the-scenes, and
inadvertently break applications that use the API.
Monday, January 13, 14
Controllers and Authentication

Monday, January 13, 14
Controllers cont.

Additional info
http://railscasts.com/episodes/350-rest-api-versioning?view=asciicast
http://collectiveidea.com/blog/archives/2013/06/13/building-awesome-rails-apis-part-1/
http://railsware.com/blog/2013/04/08/api-with-ruby-on-rails-useful-tricks
https://github.com/rails-api/active_model_serializers

Monday, January 13, 14
Authentication

Additional info
http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html
http://railscasts.com/episodes/352-securing-an-api?view=asciicast

Monday, January 13, 14
Authentication in Action

Monday, January 13, 14
Cool, we have a Users Resource which is accessible via the
routes we’ve created on /api/users... what does that have to
do with sending push-notifications to phones?

Monday, January 13, 14
How do Push Notifications work? (iOS)

Phase 1

Good documentation of the process can be found on Adobe’s site for Adobe AIR (seriously)
http://www.adobe.com/devnet/air/articles/ios-push-notifications.html
Monday, January 13, 14

Phase 2
Next, install a background processing
system of your choice

https://www.ruby-toolbox.com/categories/Background_Jobs

Monday, January 13, 14
iOS worker for Sidekiq

Monday, January 13, 14
Android worker for Sidekiq

Monday, January 13, 14
Final example

•
•

A final example with some additional features is available [1]

•

Primary Gems used:

Much credit is due to Ryan Bates for the API skeleton [2] and authentication
implementation [3], and wellwithme.com for their original Android/iOS push
notifications tutorial. [4]

•
•
•
•
•

Sidekiq
Sidetiq
Grocer

•

Friendly ID

GCM
Active Model Serializers

[1] https://bitbucket.org/momer/example-mobile-pns/src
[2] http://railscasts.com/episodes/350-rest-api-versioning
[3] http://railscasts.com/episodes/352-securing-an-api
[4] http://blog.wellwith.me/how-to-send-ios-and-android-notifications-from-your-rails-backend
Monday, January 13, 14

More Related Content

PPTX
Thariq ramadhan final presentation
PDF
Hangman game - AI Powered and in Python
PDF
Appurify - Runtime Debugging, Performance Optimization and Automated CI
PDF
Testing PWAs - Testbash 2019
DOC
Rails notification
PDF
Mobile Push Notifications
PDF
Human Computer Interaction - mobility
PDF
My rails way
Thariq ramadhan final presentation
Hangman game - AI Powered and in Python
Appurify - Runtime Debugging, Performance Optimization and Automated CI
Testing PWAs - Testbash 2019
Rails notification
Mobile Push Notifications
Human Computer Interaction - mobility
My rails way

Similar to Example Mobile Push Notification Service in Rails (20)

PDF
Uber’s Fascinating World of Inter-App Communications
KEY
iPhone App from concept to product
PPTX
2016 05-07 amro handy labs workshop
PDF
API presentation
PPTX
The Chronicle of iPhone Automation -- From Frank to UISpec to UIAutomation to...
PDF
Developing a Demo Application with Angular 4 - J2I
PDF
A Step-By-Step Guide to Building Codeless Web Apps
PPTX
Progressive Web Apps - Overview & Getting Started
PDF
Developer connect - microservices
PPTX
How to make an app?
PDF
A_Complete_Guide_to_API_Development.pdf
PDF
W make104
PDF
Bus tracking application project report
PPTX
Eval 4
PDF
Speed in the Opera mobile browsers
PDF
Evaluation question 4
PDF
Sam segal resume
PPTX
Service virtualization with npm modules updated
PDF
9/24/2015 Webinar: Designing Mobile Learning Apps for Education
KEY
Socialcam: Concept to MVP to 250k users in under 3 Months
Uber’s Fascinating World of Inter-App Communications
iPhone App from concept to product
2016 05-07 amro handy labs workshop
API presentation
The Chronicle of iPhone Automation -- From Frank to UISpec to UIAutomation to...
Developing a Demo Application with Angular 4 - J2I
A Step-By-Step Guide to Building Codeless Web Apps
Progressive Web Apps - Overview & Getting Started
Developer connect - microservices
How to make an app?
A_Complete_Guide_to_API_Development.pdf
W make104
Bus tracking application project report
Eval 4
Speed in the Opera mobile browsers
Evaluation question 4
Sam segal resume
Service virtualization with npm modules updated
9/24/2015 Webinar: Designing Mobile Learning Apps for Education
Socialcam: Concept to MVP to 250k users in under 3 Months
Ad

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced IT Governance
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Electronic commerce courselecture one. Pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Per capita expenditure prediction using model stacking based on satellite ima...
GamePlan Trading System Review: Professional Trader's Honest Take
Advanced methodologies resolving dimensionality complications for autism neur...
Review of recent advances in non-invasive hemoglobin estimation
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
NewMind AI Monthly Chronicles - July 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced IT Governance
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
Understanding_Digital_Forensics_Presentation.pptx
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Ad

Example Mobile Push Notification Service in Rails