This tutorial will help you configure a push notification service for mobile apps on all versions of iOS devices, and covers steps like creating p12 files.

seen from United Kingdom
seen from Russia
seen from Poland
seen from Netherlands
seen from China
seen from United States
seen from China
seen from Germany

seen from Bulgaria
seen from Netherlands
seen from Malaysia
seen from China
seen from Switzerland

seen from United States
seen from China

seen from Malaysia
seen from Germany
seen from United States

seen from United States
seen from China
This tutorial will help you configure a push notification service for mobile apps on all versions of iOS devices, and covers steps like creating p12 files.
Knotty point Even A Small Australian Affair Needs An App
How Can An App Relief My Small Business<\p>
Many companies are statuelike on the fence when deciding whether or not in contemplation of come out an App for marketing purposes but what we can't ignore are the poetryless else all great statistics dalliance around the Application marketing methods. By 2015 at least 87% of Australians will plead guilty a smart phone, this means the meat of the Australian dwarf star could really be carrying your business on every side in their pockets and bags. In exhibit in March 2013 around 600 million apps were downloaded within Cairns, Melbourne, Sydney and other areas wherever you look Australia€ that's 13,500 app downloads\minute!<\p>
You may even feel that your business is sane too dwarfish to need an App which is easy to understand considering the cost touching designing and developing an app demote prevail extremely daunting, yet companies who develop your app completely in-house away from design so as to completion, seize the capability till offer bespoke App solutions at a more than affordable price as they don't manifesto to outsource any of the culture.<\p>
Another doubt that seems on route to continue cropping up is that many diluted to medium enterprises be informed already attained an online presence in all respects a website. A absolutely effective point considering some web design firms detail a small fortune for methodic the most homely packages and rapacious amounts if oneself draw over online and charge ecommerce functionalities. Many regarding these websites become neglected, never seeing table of contents 1 re Google and quite the contrary generating the expected ROI. Way out comparison the budget items of an App can endure half that of a website, especially if your company is provisioning online. Also Apps are much easier to update and have many features such as push messaging to prevail on the population to encounter into your business save having to calculate on top search ac motor rankings. <\p>
Apps can be built anticlockwise your business needs and push messaging is only one of the many functions that can encourage your app users to spend money on your products and services. Getting customers to download your mobile entreaty can move homespun simple using QR codes and low cost local advertising.<\p>
The bottom pencil is that even small businesses within Australia are hurling number one onto the App bandwagon. They're already using features congenator so QR coupons and push messaging to create and reinforce a busy business€ .the question is whether you stick in order to your guns and rely on €word of mouth€ or keep upcast therewith your competitors.<\p>
If myself would like any over notification on anything covered fashionable this singleton please show a tendency to http:\\www.titanappsolutions.com.au <\p>
The Power of Push and App Invites
When Tapstream released its cross platform app invites product called ’Word of Mouth’ we were thrilled to finally deliver a solution that helped unlock virality. As is often the case with cutting edge technology, we built WoM by paying close attention to what our customers were already doing with our platform, along with being acutely aware of their biggest pain points, namely, the increasingly prohibitive cost of paid UA.
We noticed many of our customers already trying to implement referral features in their apps, trying to drive user acquisition through social, and we wondered if there wasn’t a way to make this easier. Like a good bottle of champagne, great apps are best shared with friends and Word of Mouth uncorks the virality trapped inside the app. Could we offer app developers the marketing equivalent of bottle service?
Google Chrome’s push notifications are now available to all
Google has released the finished public version of Chrome v42, which lets websites send you alerts (with your permission, of course) whether or not the browser is open.
You can get breaking news, for example or find out when someone outbid you on that important auction you forgot to watch and the message will just appear in the top corner of your screen without the need to have your browser open. My guess would be that Google will eventually allow some customisation of the message window, its appearance, location on the screen and the notification sound.
The feature will be more than a little familiar to Safari users who for sometime have had this feature, but with the public release of Chrome v42 this is now platform-independent -- you should see it in Linux and Windows versions too.
How do you get it? Well Google Chrome for sometime has been able to silently install updates and keep your browser updated, if you allowed this at first installation. If not two methods can be used, one is simple re-install chrome from Google or even simpler go to the About Chrome menu item in the menu this will check the version and offer any updates.
Captive Portals Push notifications can allow users to opt-in to timely updates from the venue owner to effectively re-engage them with customised, engaging content long after they have left their WiFi service coverage area.
Odyssys® can utilise Chromes new push notifications to allow captive portal owners the ability to ask users to subscribe to their venue’s messaging service. The true beauty being that the venue owners can interact with the users device well beyond the bounds of their own WiFi… Allowing Venue owners to extend their power and reach of their brand and engagement with customised tailored messages.
As of the release of Chrome version 42, the Push API and Notification API are available to developers to start working on these areas.
Odyssys® already has the essential tools in place to provide push messaging and our enhanced location engine can help target and drive brand engagement beyond the reach of the venues WiFi. Further more the messaging does not have to be a one to many message, tailored or personal messages can be sent.
When the user grants permission to receive these messages they become essentially a subscriber to the venues service and get assigned a unique subscriberID allowing for targeted message sending, based on demographics or other know information about that WiFi device, user or user habits.
Push notifications can allow users to opt-in to timely updates from a Captive Portal or Splash page and allow the venue owner to effectively re-engage them with customised, engaging content, even when they do not have their browser open!
Global Reach & Odyssys® Global Reach Technology is a software innovator and the leading provider of carrier-grade WiFi and Passpoint™ Hotspot 2.0 services. We have packaged our carrier-grade solution into our Odyssys® software to provide businesses large and small with private and public WiFi built on a carrier-grade platform.
Chris Spencer (D.Sc) - VP Technology Global Reach Technology Limited http://www.globalreachtech.com
via https://dayone.me/1FcazVV
iOS Push Messaging with ZeroPush
I have recently been working on two applications that deliver push messages to subscribed iPhones and iPads. While building out the infrastructure, I learned quite a bit about the idiosyncrasies of the Apple Push Notificiation System and various solutions that have sprung up to provide a better interface to APNS.
Your ideas are intriguing to me and I wish to subscribe to your newsletter
When you allow an application to subscribe you to their push messages, here's what happens in a nutshell:
Your application sends a subscription request to Apple's APNS gateway
APNS responds with a unique token. This token is what ties your device to a registered iOS application.
Your application then takes that token and sends it to some server-backed application.
One long-time iOS developer I talked to expressed surprise and disappointment that Apple still hasn't provided their own service to execute delivery of pushes. As it stands, if you want to send pushes to your app users, you must have your own server-side application or register with a service like Urban Airship or ZeroPush. You send push messages to a given application by sending APNS a message that consists of the token along with some combination of message text, an update for the application's badge count, a sound to be played, and some optional data that can be used to determine things such as where to go in the application when the push message is swiped. It's important that you don't know anything about the user from their token other than that they registered. If you want to tie the subscription to a specific user (which you'll want to do if any of your messaging is targeted or individualized rather than just broadcasts to all users), you'll want to send a UID or email address or other identifier to your server application at the same time you forward along the token.
Asynchronicity
The biggest challenge with push messaging is dealing with Apple's quirky behavior when you start sending push messages at any kind of volume. When you send a push message through APNS, you open a socket connection to the APNS gateway, send your message, and then close the socket. If you are opening and closing sockets too frequently, Apple will think you are a potential DOS attacker and temporarily ban you from connecting. The way around this is to open your socket and then send many messages on a single connection.
Here's the problem: This connection is asynchronous, which means you're sending data over the socket and not waiting for a response from Apple for any particular message. If this sounds perilous, you're right! If you send a message that is declined for any reason, such as sending a bad token, etc., APNS unceremoniously terminates the socket without any error message. Because the connection is asynchronous, APNS may terminate the socket due to a message that is not the last one you sent, which makes it very difficult to know which message or token was the culprit.
After experimenting with APNS on Rails, Grocer, Orbiter (via Helios) and Houston, I was extremely frustrated. None of the gems handled the issue of bad tokens (all of which had entered my database during user testing with my client's client) causing APNS to kill my socket. A pull request to Houston that has since been accepted appears to have solved the issue, but at the time of our development, but we began by using a combination of a fork of Houston including the socket fix pull request. Apple requires app developers to clean out bad tokens, which are usually the result of users unsubscribing from push messages, so we were also using a small part of the Grocer to managing the sweeping and removal of bad tokens. Many of these gems are still very immature, and there isn't yet a clear standard in this space.
Using ZeroPush
I began to investigate using a service rather than home-built code to abstract away the rougher edges of dealing with APNS. UrbanAirship is the dominant player in this space, but their pricing for lower-volume senders is fairly high. Through the Heroku addons portal we found ZeroPush.
ZeroPush is still in beta, but we found that they had the holy trinity of service-layer software: an easy API, cheap pricing, and awesome customer service. After some initial testing with ZeroPush and their gem, I found that it wasn't designed for multi-threaded operation. My client has multiple iOS applications powered by our backend, so I needed to be able to open multiple simultaneous connections to APNS, one for each application that might be sending messages. I sent a message to ZeroPush's customer service address, and minutes later Stefan at ZeroPush called me to discuss the problem. Less than two hours later I had a recommended workaround in place. Less than two days later, ZeroPush had already made upgrades to their gem that helped solve my problem without the workaround we had created. I cannot recommend ZeroPush highly enough. Their API is very simple, has good documentation, and we found that it was a very reliable way to interface with APNS.
Using ZeroPush's interface, we were able to trim our APNS code down to just a few classes. Here's how we send batch messages to ZeroPush:
## # Delivers push notifications to APNS. ## class PushNotificationsDelivery def initialize(organization) @organization = organization @connection = ZeroPushConnection.new(organization) end def deliver deliver_and_mark_notifications end private attr_reader :connection, :organization delegate :apns_notifications, :ios_application, to: :organization def deliver_and_mark_notifications unsent_notifications.each do |notification| connection.notify(notification.parameters_for_zero_push) notification.mark_delivered end end def unsent_notifications apns_notifications.unsent_and_ready_for_delivery end end
ZeroPush handles the socket connection for us, sparing us from the worry of having to manage the connection. We just send messages to ZeroPush, and they handle delivery and reporting unsubscribed tokens for us. It's worth noting that the PushNotificationsDelivery class described above is provides us with a layer of abstraction that will allow us to change providers or add Android push messages (as the client will be doing this month) easily without huge changes to our code. Using a third party service also keeps our specs clean. Our model test verifies that the right message gets sent to the ZeroPush client object, and integration tests verify that we are hitting the ZeroPush sandbox gateway.
Give it a try with your own app.
Urban Airship puts SimpleGeo to use with location-based messaging
#SuryaRay #Surya App messaging platform Urban Airship bought SimpleGeo, a location data provider, last November and now it’s finally showing off how the two are coming together. Urban Airship (see disclosure below) is launching a new Location Messaging Service that allows developers to incorporate current and historical location data of users to create more relevant in-app notifications. Now, instead of just relying on user in-app behavior and stated preferences to target messages, developers of apps with location data can look at where a user has been, in the last-minute or the last year. By combining both place and behavior data, Urban Airship is looking to help developers create more tailored messages that can drive re-engagement with an app, more sales and increase loyalty. While other push messaging services have incorporated location data, Urban Airship isn’t just trying to create simple geo-fences that measure a user’s current proximity to a target. By incorporating historical data as well, it allows developers to target unique segments of users who have gone somewhere in the past. For example, a developer can send a notification to anyone that’s traveled to a specific place over the last year. Or they can push messages to people who have visited Central Park or Madison Square Garden in the last day, week or month. A user who appears to have moved to a new location can also be targeted with a unique message. Urban Airship has created 2.5 million unique geo-fences — everything from time zones and cities to neighborhoods or venues – that also allow developers to send different messages to people in the same area. For people attending a baseball game, for example, the local team’s app can push a survey or a special deal to people in attendance while alerting nearby users of available tickets. The Official London Olympics 2012 Join In app tested the service and sent more than 10 million location-based messages to people at Olympic venues and received a click-through rate of around 60 percent. Location-based messaging and marketing has been touted as a potential game-changer in advertising, but it’s still struggling to fulfill its promise. But we’re seeing now with efforts from mobile ad startups Sense Networks and JiWire that combining place data with user behavior can create a lot more smart targeting of users. It’s not enough to just look at where a person is at the moment, you have to tie their historical movements together to better compose a behavioral profile of that user. But I’m wondering how mobile app users will react when they realize how much of their historical data is being used to craft in-app messages for them. Right now, most apps ask users to opt into sharing their location data to help them find nearby things. But if my travel app starts asking if I want deals to go back to a specific vacation spot I visited, it might feel a little creepy. Brent Heiggelke, chief marketing officer of Urban Airship told me developers will need to use some common sense in how they use location data. But he said users are now more aware of how their data is being used and they’re generally OK with it if it leads to delightful experiences. We’ll have to see if developers know the difference between delightful and creepy. But if done well, which will include more work than regular messaging, this could demonstrate the power of location-based services to users. Disclosure: _Urban Airship is backed by True Ventures, a venture capital firm that is an investor in the parent company of this blog, Giga Omni Media. Om Malik, the founder of Giga Omni Media, is also a venture partner at True._ http://dlvr.it/2FSbsY @suryaray
Building Chatter: Part 6 - Welcome to the Realtime
So, we have the barebones of our application up and running, but it wouldn't be much good if you had to constantly refresh the page to see what people are talking about. When I create a post, I want anybody who I mention to know that I've mentioned them immediately, and if I am searching for a topic, then I want any new messages about that topic to be delivered to me immediately.
We will set up the ability to do this in two stages - first we will look at mentions "@username" in a post, and then we will look at searches.
Live feeding the @users.
Detecting @user tags
Delivering the message
Improving the application
Ok, so we need a system for detecting the tags in the posts as they are submitted. To do this, we are going to open up our Post model again, and make some changes. Processing notifications isn't really something that a post needs to be aware of, that is something that happens in the background, and because of this, Rails provides us with a type of "listener", called an Observer. Observers monitor a model, and carry out actions whenever a callback would have been fired. This means that we can separate our concerns - the Post model describes the posts, and a PostObserver will monitor this and start the communication system.
If you need a copy of the application so far, remember it is on Github, once you've cloned it then "git checkout part5" to bring you up to date.
Let's begin.
The first thing we need to do is generate our Observer. In a terminal at the root of your application, run:
$ rails g observer Post
Now, go to "app/models/post_observer.rb" and we are going to implement some of the functionality that we already had in our Post model:
class PostObserver < ActiveRecord::Observer observe Post def after_commit(post) TAG_PROCESSOR.push(:tag_class => Tag, :post_id => post.id) end end
We can now remove some lines from "app/models/post.rb":
delete - after_commit :process_tags delete - def process_tags delete - TAG_PROCESSOR.push(:tag_class => Tag, :post_id => self.id) delete - end
Finally, to get this observer observing, we need to update a line in "config/application.rb":
# Activate observers that should always be running. config.active_record.observers = :post_observer
If we were to restart the server now, then we would see that our previous functionality still works, but it now located in a more sensible and logical place. The task at hand now is to work out how we want users mentioned in posts to interact with them. The most simple method, and the one we will use, is to create another relationship between users and posts, however you could look at serializing a field, or a number of other tricks. We are going to use another "has_many, :through =>" type relationship, this time called Mention:
$ rails g model mention post_id:integer user_id:integer
And then in the migration file for this, (in "db/migrate") we need to add a few things to create the indexes for the table. Add the following below the change method block:
add_index :mentions, :post_id add_index :mentions, :user_id
Now we can migrate the database ("rake db:migrate") again, and then set up the relationship in our models. In "app/models/user.rb" we need to add the following, probably near your other relationship declarations ("belongs_to", "has_many" etc).
has_many :mentions has_many :mentioned_ins, :through => :mentions, :source => :post
We also need to add something similar to our Post model in "app/models/post.rb":
has_many :mentions has_many :mentionings, :through => :mentions, :source => :user
Finally we need to add a couple of lines to the Mention model in "app/models/mention.rb":
belongs_to :user belongs_to :post
Perfect. We've got the join model set up properly, so we can go ahead and detect usernames in the posts as they come in now.
Detecting Mentions
To detect the mentions, it's actually going to be very easy, as we have done most of the hard work already! The tool that we need we made earlier, so open up "app/models/post_observer.rb" and make the following changes:
class PostObserver < ActiveRecord::Observer observe Post def after_commit(post) TAG_PROCESSOR.push(:post_id => post.id) users = User.find_all_by_username(detect_usernames(post.body)) if users users.each do |u| u.mentioned_ins << post end end end private def detect_usernames(post) post.scan(/B@(w*[A-Za-z0-9_]+w*)/).flatten end end
This now will find all the usernames in the body of the post, and then for each user it finds that corresponds, it will add a mention for them. The reason we aren't delaying this and using Girl Friday again is that we want these notifications to be absolutely realtime - if someone says my name I don't want to wait to hear it, whereas if the notifications about topics arrive a second or two later when the service is busy, that isn't the end of the world (although obviously that isn't desirable).
Let's spin up the server and create a new post that mentions another (existing) user. To do this, we use "foreman start", if you've forgotten since last time.
So, we have created a new post with (in my case) "@billgates" in there, which means that our observer should have picked this up and created a new record in the mention model for us. We can check this by going to the terminal and typing:
$ rails c
Which fires up a command line IRB session, with our Rails environment fully loaded in it. If you aren't familiar with the rails console - spend some time playing around, you can do an amazing amount of stuff, and it serves as a phenomenal test-bed for experimentation.
> Mention.first
You'll see the console perform a database query, and come up with a Mention, linking your last post with the user you tagged in it! Perfect. We can just double check that it worked in both directions, by typing (in my case):
> User.find_by_username("billgates").mentioned_ins
And you should see the post that you mentioned the user in. Type "exit" to get out of the console, and we'll get on with the next steps. Now we have a system for detecting when we have tagged a person, we need to start implementing the "realtime" part of the application.
Realtime Rails
Rails, and Ruby in general, isn't particularly good at "realtime" web applications. This is due to something called the GIL or Global Interpreter Lock, which massively hampers the amount of concurrency (things done at once) that Ruby can cope with. However, this situation is improving, and often being bound by a constraint like the GIL forces the developer to come up with a cleverer solution to the problem.
There are a lot of "push api" providers - companies that offer a product to abstract this functionality away from the application, and to be honest in most cases using them is a good idea. In a later tutorial we will revisit this next section, and show you how to implement your own push server using something called Faye, but this is a little more complex that we are going to deal with yet. We're going to use a really solid service - PubNub that offers unlimited free testing whilst in development mode. A caveat here - to do this, you have to use a shared "demo" key, which means that anyone could potentially listen in to your messages, so don't transmit anything too important!
To use PubNub, we're going to add a gem to our Gemfile:
gem "pubnub-ruby"
And then we need to run "bundle" to get that installed. We also will create a new initializer file - "config/initializers/pubnub.rb":
PUBNUB = Pubnub.new( "demo", ## PUBLISH_KEY "demo", ## SUBSCRIBE_KEY "", ## SECRET_KEY false ## SSL_ON? )
We will also need another observer, so run "rails g observer Mention" and then open the file it created ("app/models/mention_observer.rb").
class MentionObserver < ActiveRecord::Observer observe Mention def after_commit(mention) end end
Before we go any further, we need to know how PubNub (and almost all push notification clients) work, so we can make a design decision for our application. The PubNub client that runs in the browser listens on what is called a "channel" - we need to know what channel we are sending our messages out on, in order to be sure that the right message is going to the right people. Rather than simply using the username, we will do something slightly more advanced.
The Message Queue
We aren't going to use a proper message queuing system such as AMQP or RabbitMQ - those are far beyond our needs, but we will need a system for managing our "live" channels. This will become more important when we bring in push functionality for tags as well.
We are going to create another model to hold this data, and we will call it Channel. It is going to need a number of fields, to allow us to access it and to provide some control over how long it keeps broadcasting for. This Channel model is going to be polymorphic - which means we can attach it to a number of other models by declare two fields an _id and a _type, prefixed with the polymorphic identity, which in our case will be broadcastable:
broadcastable_id - the id of the related model
broadcastable_type - the class of the related model
channel_ident - a string to identify the channel
last_validated - a timestamp for when the channel was last declared to be needed
So, lets generate this model:
$ rails g model channel broadcastable_id:integer broadcastable_type:string channel_ident:string last_validated:datetime
Add this line underneath the create_table block in the migration that produced:
add_index :channels, [:broadcastable_id, :broadcastable_type]
You can now run "rake db:migrate" to add this table. Then we need to add some code to a few models:
# in 'app/models/channel.rb' belongs_to :broadcastable, :polymorphic => true # in 'app/models/user.rb' has_one :channel, :as => :broadcastable # in 'app/models/tag.rb' has_one :channel, :as => :broadcastable
Ok, so now we have a mechanism for controlling our channels, lets go back to MentionObserver ("app/models/mention_observer.rb") and finish creating it. Change the after_commit method to the following:
def after_commit(mention) NOTIFY_QUEUE.push(:post_id => mention.post_id, :user_id => mention.user_id) end
You might recognise this as another Girl Friday method, and earlier I said that we didn't want to wait for this to happen. There is a good reason though why we need to at this stage. The call to send the post to PubNub to send to the user requires a call to an external server, and we don't know how long this will take to respond. We don't want to block up our whole application if PubNub is a bit slow in getting back to us, so at this point we need to call on this web service behind the scenes. Let's add another processing action into Girl Friday - edit "config/initializers/girl_friday.rb" and change as so (note the subtle change to the TAG_PROCESSOR as well):
TAG_PROCESSOR = GirlFriday::WorkQueue.new(:post_process, :size => 2) do |msg| Tag.process_tags(msg[:post_id]) end NOTIFY_QUEUE = GirlFriday::WorkQueue.new(:post_process, :size => 2) do |msg| Notify.deliver_message_to_user(msg) end
You'll note here that we are calling a method on a class called Notify. We haven't written that yet, so lets create a new file in the models folder called "notify.rb", and fill it with the following:
class Notify def self.deliver_message_to_user(params) post = Post.find(params[:post_id]) user = User.find(params[:user_id]) user.channel ||= Channel.new( :channel_ident => Digest::SHA1.hexdigest(user.username, user.created_at.to_s)) PUBNUB.publish({ 'channel' => user.channel.channel_ident, 'message' => post.to_json(:include => :user) }) end end
Now, we are nearly ready to test this out. We just need to edit a couple of client side files, and we are good to go. First, we need to add the following to "app/views/dashboard/index.html.erb", just at the bottom of the file.
<script> // ------------------- // LISTEN FOR MESSAGES // ------------------- PUBNUB.subscribe({ channel : "<%= Digest::SHA1.hexdigest(current_user.username, current_user.created_at) %>", callback : function(message) { alert(message) } }) </script>
Then we need to add a couple of bits to "app/views/layouts/application.js", insert these directly before the "<%= yield %>" line:
<div id=pubnub pub-key=demo sub-key=demo ssl=off origin=pubsub.pubnub.com ></div> <script src=http://cdn.pubnub.com/pubnub-3.1.min.js ></script>
We also need to add the MentionObserver to "config/application.rb" - so change that line so that it reads:
config.active_record.observers = :post_observer, :mention_observer
Ok, we are going to need two terminal windows for this bit, and a web browser. Fire up the webserver in one terminal, and a console in the other ("foreman start", and "rails c" respectively). Then, go to the home page in a web browser, and - leaving the browser visible in front of you, type the following into the console, replacing "@USERNAME" with the username of the user you are signed in as.
Post.create(:body => "hello there @USERNAME")
You should be able to see a Javascript alert window pop up with the content of the post that you just created, fired to you in Realtime. Next time we'll go over how to make this a bit smarter and display the post, and we'll be using something called Handlebars.js to make the whole of the interface a lot snappier.
If anyone has any questions, please feel free to ask away, and as ever, the source code is available on Github, this time in the "part6" branch.