How to send push notifications to a specific device through fcm without authorization or google account? - push

I want to have my application receive notifications without forcing the user to be logged in or authenticated. Thank you for your time!

Well, I'm using OneSignal to send notificaitions to the users of my Android app and it's working fine. Moreover, it uses FCM as its base. So, that shouldn't be a problem too. You can segment users thet way you want and send notifications to one or many - upto you. It's all for free and very easy to set up the basics of it. It's here: OneSignal

You can probably use Socket IO for your case to send messages from one device to another.
There are many good to have Socket IO frameworks which can consider for your requirement
Signal R in Android
SignalR is a new library used to add real-time web functionality to your applications. Signal R uses technology such as
web sockets
Event Source,
forever frame
long polling
Signal R is capable of selecting the best from those four technology depending on your internet connection and your application stability.
Signal R is used in application such as
Chatting application
Stock market application
Real-time gaming
Native Socket.IO
Socket.IO provides an event-oriented API that works across all networks, devices and browsers. Its incredibly robust (works even behind corporate proxies!) and highly performant, which is very suitable for multiplayer games or realtime communication.

Related

If I run my own push notification server do I still need FCM?

I've just read alot about push notification servers, self-hosted ones as well as cloud. and I am pretty much confused about one aspect.
I need push notifications for my Android/iOS app for more than a million devices using the same app. now there is no free service for that scale and paid services will result in too much monthly fees, so I thought about running my own server with an open source solution. I've checked Many but parse seems to be the best fit. but they say that it uses FCM and I know from google pricing that it is free only for a limited number of registered devices. I thought that hosting my own push server would spare me those fees; but it seems like not; what good is it then ? wouldnt it be better to just use FCM directly ?
Delivering push notifications to Android (with Google Play Services) and iOS will always use FCM or APNS respectively. The reason is that those services are built into the operating system, or built closer to the operating system than regular application can function and get reliability and battery life advantages from that. Both FCM and APNS are completely free and unlimited, although both have quota to protect the services against abuse.
There are many services (such as Parse Push, Airship, OneSignal, etc) that build on top of FCM and APNS to provide higher level messaging operations. But at a lower level these will be using APNS and FCM for the actual delivery of the messages.
That's also what you have to think of when you considering building your own server: what will that server actually do to deliver the messages to the devices? If you're not using FCM/APNS, how do you get the message to the device, especially when the user is not actively using the app?

Socket connection between rails and iphone native app

I have an iphone app with rails serving as a backend server.
Now I need to implement a chat functionality using sockets connections.
A lot of examples show you how to implement chat using sockets in browser.
What I need here is how I can implement an application where you create socket server in the rails app , and the client in iphone app which listens to the channel I give them.
I tried using faye(examples given only how to implement client in the browser) and using fayeObjC library for iphone to create client, but am not able to listen to the channel from this library.I know I must be implementing it wrong here.
I'll share my code also here, but first I need to know is there a better solution than this?
Also I appreciate some links to some examples where socket server is in rails and clients are iphone app.
Appreciate any help and mostly need a right direction to implement it.
Update
I tried the faye combination again and it worked.Although still looking for more solutions.
You can check about TCP sockets:
http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
Chat Application Using Ruby
http://quickblox.com/modules/chat/
http://caydenliew.com/2011/11/ios-mac-os-communication-with-asyncsocket/
http://www.macresearch.org/cocoa-scientists-part-xxix-message
Next link is a comprehensive Networking Guide - Using Internet Sockets
You must keep in mind two major problems to peer-to-peer communications (Chat): reachability and how to receive new messages while your application is in the background (get notifications).
For the last you can use APNS approach: an invisible notification will be pushed to the iPhone indicating that a new message is ready to be read. So your app will make a request for unread messages (what app like WhatsApp does).
Besides TCP sockets you could use websockets (HTTP - so there are no firewall problems).
Best in class - Socket.IO.
Here you will find the wiki https://github.com/learnboost/socket.io/wiki (you will find there an extension for Ruby also)
Here an example for iOS chat client for socket.io & node.js backend
Jabber
Another option: XMPP - "stands for eXtensible Messaging and Presence Protocol. Such a protocol is open-standard and oriented to message exchange (builds and maintains by Jabber community). Message exchange happens near real time, so it is an ideal infrastructure to build chat-like applications. The protocol also implements a mechanism to notify presence information (whether a user is online or not) and the maintenance of a contact list. XMPP is a thorough protocol, which has been adopted also by big companies like Google to build their Instant Messaging service."
Here you will find all about developing a Jabber Client for iOS (enable users to sign in, add buddies, and send messages; how to install and configure a jabber server, create accounts, and interact with the server from an iOS application http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
I know that SocketRocket by square is a strong native Objective-C library. But it doesn't offer the channel abstraction you seem to be looking for.
If you would consider outsourcing the WebSocket connections then you could use a hosted service like Pusher, who I work for. You can publish messages (trigger events) on channels using the pusher-gem. And you can subscribe to channels and receive messages using one of Pusher's Objective-C libraries.
Other solutions will also have Objective-C libraries and you can find a list of them via this realtime web tech guide.

Server framework to use for realtime iPhone app

I am currently writing an iPhone application that sends and receives JSON data from a remote server to essentially display realtime information. Me and my partner started the project using Google App Engine (Python) for the server-side implementation mostly because it was easy to pick up and seemed suitable for our needs at the time. However, we're only just now starting to see the downsides of the framework for realtime iPhone apps - APNS is not at all supported, and neither is the GAE Channels API. So our only option for displaying the realtime server data on our app is to continuously poll the server, which certainly seems like horrible design.
We'll have to port our server-side code to a new framework. My question is, which one do we use? From numerous searches, I still have yet to find a satisfactory answer.
I should mention that I don't necessarily want the server to send push notifications. I just want to be able to push data to clients in real-time, and then manipulate that data on the iPhone client-side code. We're fine with setting up the framework on a local server if we have to.
Since you don't want to be pull data in background (lett alone if it is even possible)will have to use APNS.
But why switch away from google app angine, you could use an APNS provider like Urban Airship wich provide there on API to connect with.
You'r not even the fist to run into this problem: Apple Push Notifications on Google Appengine
Probably the easiest realtime framework you can use for sending data to iOS clients in real-time is PubNub (http://www.pubnub.com). It's reasonably priced, and it scales to anything you can throw at it. In my experience, it has no problem delivering a message to an end client in under .25 milliseconds (regardless of the number of clients it's being sent to).
Their latest version also supports APNS functionality for when you app isn't in the foreground.
https://github.com/pubnub/objective-c/blob/master/iOS/README_FOR_APNS.md
If you want to create your own APNS server (since you are running on App Engine anyway), there are examples of how to do that using App Engine's new Socket API. I've written a demo python AppEngine application that people might find helpful in this regard.
https://github.com/GarettRogers/appengine-apns-gcm

Anyone using XMPP to implement Push Notifications on iOS?

I'm looking for any reference projects or key learning from anyone who has implemented XMPP/Jabber to successfully send notifications to iOS devices (iPhone/iPad).
I'm considering using an XMPP server (OpenFire specifically) to provide a single cross platform mobile push system. C2DM for android has a number of annoying requirements like users having Google accounts. This is what got me started looking at XMPP. I also need to support pushing to iOS devices. I know all about APNS, however I'm wondering if I could use the XMPP server for both Android and iOS platforms (and possibly more like Black Berry).
The things I feel might come up are:
iOS killing any persistent connection to the XMPP server. Will it
auto reconnect?
iOS preventing access to certain ports or protocols.
Anything to be aware of here?
Other gotchas one would only discover
by trying this?
Here you can find the answer to your first question:
when your app goes in background you (the client) close the connection
with the xmpp server. When your app comes back into foreground you
reopen the connection. If your server need to send messages to your
client, it must use push notifications. When the client receives the
notification can (it depends on the user action) go back to
foreground.
(source: iOS Backgrounding & XMPPFramework)

Can an iPhone app act as a server to send messages or push notifications?

I want to write an iOS app that can act as a client and a server to other iPhones over the cellular data network (i.e., without a typical centralized server). The goal is to share series of about 200 short event messages, one at a time, from the iPhone server to multiple iPhone clients by some means of notification. Apple Push Notification service would be fine for such notifications, but there is no need to use it specifically.
I think sending push notifications from one iPhone to another is possible by connecting to gateway.push.apple.com from the serving iPhone as described in the Local and Push Notification Programming Guide, but I can't find anyone else discussing this approach (maybe it's too obvious?).
The reason for all this is an attempt to avoid the overhead of infrastructure. If this isn't feasible, alternatives which minimize or avoid additional hardware are welcome.
Requirements:
Communication must be [strictly] over cellular data network
Wi-Fi isn't available
Bluetooth doesn't have enough range
Unidirectional communication with an iPhone server multicasting to many iPhone clients
No jailbreaking
Ideally the serving phone's battery will be able to handle this without a recharge
Update 5/4/11 2:12 AM EST: Just to be clear, I don't have any particular requirement to use APNs; I thought it may have been feasible in this setup, but from the discussion below, it sounds like that's not the case. However, I'm still interested in any other system that could help me achieve the same end result with some type of message passing or similar form of communication.
Theoretically you should be able to write a iOS app that can connect to the APNS and send notifications to other devices running your applications. However, your main problem will be to actually acquire the 'tokens' of other devices. When you have a centralized server doing the job, its always online and thus, the clients can 'talk' to it via http and register them self (giving their tokens to the server in the process). Thus the server knows the client token and it can use them to send notifications to the clients via APNS.
However this is not possible in the scenario you are talking about. But this is not to say its impossible. May be you could use an email account X, to store all client tokens. Every client will send a email to this account with their token in it. So when a another 'client' want to send a notification to another client, it can find out the token by reffering to the inbox of the email account (you can cache this stuff and optimize it in a zillion ways of course).
But the point is some how a (third party(ex: email service provider)/your own) server that is online 24/7 will be involved in the process.
Let us know how you progress with this. It would be interesting to know.