Push notification guide? - iphone

i need a rundown on how to fully utilise the push notification system. Iv read the push notification guide on the apple website but still unclear of some things.
Lets say i have a windows PC and an iPad.
1) what should the PC be configured with to become a "provider"? Should it be configured to be like a server, giving out data upon requests.
2) How does the provider send the token to the APNs?
The reason for using the push notification system is so that i can invoke a (tablereload data) method so that it would update the table as it has some custom images added as its subview so it would change images if some conditions in the server side were met.
Thanks for reading guys , hoping for any kind of feedback or help.
Cheers, Ephist

For anything other than development and testing, you'll generally want to run the provider on a server infrastructure that's not hosted on a home Windows machine.
You can either use a commercial provider like iLime or Urban Airship, but there's also a few tutorials and open source solutions out there:
EasyAPNS (Push notifications using PHP & MySQL)
How to build an Apple Push Notification provider server (tutorial)
PHP Apple Push Notification Server
Programming Apple Push Notification Services (contains details on certificate configuration)
There's also a local test app for Mac OS called PushMeBaby that you can use for development purposes.

There's is one more interesting tutorial here: http://mobiforge.com/developing/story/programming-apple-push-notification-services

show here.
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
Above Link Dead...try this
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/Introduction.html

There's other solutions like Xtify or Mainline or PushWoosh or more recently Windows Cloud Azur.
Easy APN stay the most relevant solution for those who choice to do it yourself (servers integration).

Related

Sending Azure Push Notifications to Production Apps Through Azure Portal

I set up the Azure environment, with the Notifications Hub and a Mobile Backend. It works perfectly and simply with the "Test Send" feature, where I receive a notification on my phone, and can dismiss it or click on it to open the app. All I am looking for is a feature similar to this, but with production capabilities. I don't want to setup more infrastructure, and write all this code, just to send the most basic of push notifications, so I am wondering how this may be done in the Microsoft Azure portal? Thanks!
Edit 1: to anyone struggling with the same problem, Microsoft also offers a service called Visual Studio App Center, which has the extavt functionality I desired, and is super easy to implement. For some reason it was listed very highly during my searches, so I never knew it existed.
I am afraid that there is ony "Test Send" feature in Azure portal. You need to accomplish this by using code or rest api. Normally, you would send notifications using a backend server. For some cases, you might want to be able to send push notifications directly from the client application.

Sending iOS push notifications from my Machine?

I would like to add iOS push notification to my FREE iOS App
The push notification will be mainly advertising my other iOS applications. so I am expecting 1 or 2 push notifications every month
I checked service like urban airship, but I think it is expensive considering I have more than 1.5 Million active users.
So, what I am thinking of is collecting the devices token at Google App Engine ( java ), then whenever I want to send push notifications I export those tokens then send them from my Machine.
Is this is the right approach? what do you think?
Is there any framework that I could use instead of building things from scratch?
Many thanks
This approach looks ok to me. Having an app on Google App Engine to whom each of the iOS device is sending their device token. Later at any time utilizing a web page or web service running on Google App Engine APP you can push custom notification to all respective device tokens. Just keep in mind to filter the list of device tokens with obsoleted ones (in case somebody uninstall your app).
You may check http://code.google.com/p/javapns/ for APNS communication. I tried it couple of times and it worked really well.
You should also give http://www.scringo.com a try.
Among other things this framework does, it also gives you a free push notifications service to send push messages to all your users or some of them (based on your custom criteria).

Is a server required for push notifications?

Just to start I, I want to say I have read the this tutorial: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
After reading it, had a few questions about push notifications... my main questions is, is a server required.
I have made an app that has informational content for my business... however every week/month or whenever I choose, I want to be able to push a message to all the user who have downloaded my app (every device would receive the same message).
Preferably, the way I would want to create and send the notifications... is through a separate app that I, the developer only has.
Now back to my question, would I need to get a server to do this?
There are a lot of free Push Notification servers - for example QuickBlox
You don't need any server code, QuickBlox already wrote all for you.
Just look at Push Notifications iOS sample - This sample enables you to send notifications and alerts to users at any time through an API or easy-to-use admin panel.
Just download it, move some code from it to your app - and enjoy it.
We use a framework called Parse that let's us send broadcast pushes to all users. You don't need to maintain a server (they do it for you). It's free for under 5 million queries a month.
No you dont need a server, you can simply create your own application that connects to the apple push notification server but you have to ensure you use the required develop/publish certificate for the ssl connection, you can see that on the tutorial you read in the "Making a PEM file" secction. He is connecting directly from his mac to the servers, it fails without the certificate but it doesnt with it.
See here:
As I’ve mentioned a few times before, you need to set up a server that
sends the push notifications to your app. For this first test, we’re
not going to set up a server just yet. Instead, I’ll give you a very
simple PHP script that sets up a connection to APNS and sends a push
notification to a device token that you specify. You can run this
straight from your Mac.
You can make your program set up a connection like that.

How to use Push Notifications

Regarding push notifications. How do I get the provision from APNS to implement push notifications in to my application. Help me guys.
start from these series
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
iOS developers love to imagine users of their awesome app using the app all day, every day. Unfortunately, the cold hard truth is that users will sometimes have to close the app and perform other activities. Laundry doesn’t fold itself, you know :]
Happily, push notifications allow developers to reach users and perform small tasks even when users aren’t actively using an app!
Push notifications have become more and more powerful since they were first introduced. In iOS 9, push notifications can:
Display a short text message
Play a notification sound
Set a badge number on the app’s icon
Provide actions the user can take without opening the app
Be silent, allowing the app to wake up in the background and perform a task
This push notifications tutorial will go over how push notifications work, and let you try out their features...
I followed the steps mentioned in raywenderlich tutorial. It's some what easy to send Push notifications to my iPhone app by using my system as the temporary server(ie, sending the message by running the PHP code from the Terminal window).
But, while going for production and dynamic messages for different users at different time, it's very tough for me to set the service in a server.
So, I go with third party server to send Push Notifications. - Parse.com
Tutorial for how to use that API.
Documentation about the installations of the application.
Here, we have a tag parse.com for questions about this process.

How do I upload files using http/ftp to iphone/ipad? (Eg. ifile, goodreader)

Is there any good advice on uploading files to the device? I've seen many apps create a http server on 80 or 8080 to upload files. Does that mean I have to implement a server too?
Are there any 3rd-party libraries? (Preferably open-source and non-GPL)
EDIT: I am going to upgrade files in the app for specific devices in a corporate environment, so the ipad pulling files from a central server is also an alternative. But I would have to send messages to these ipads to tell them to fetch those files.
But I would have to send messages to
these ipads to tell them to fetch
those files.
Push Notification Programming Guide
Or mail with custom URL scheme for launching your application.
iOS Application Programming Guide - Implementing Custom URL Schemes
I assume what you want is a kind of automatic update. An app do something by order from server without user's manual operation.
I don't know enterprise-license specific feature of iOS. But I believe there's no such enterprise-specific APIs. And as I know, automatic update is almost impossible. Because,
There is no system-level support for automatic update. (yet?)
So messaging and fetching feature should be implemented in app.
But no app is guaranteed to run in background for long time.
And also user can turn off any app at any time.
There is no way to send message to an app which is not running.
Even you can send, there is no way to address each client form the server.
If your app is running, sending message or commanding them to fetch or do anything is just a simple work. The problem is there is no regular way to force them always keep alive. Even under situations like OS reboot or abnormal termination.
However there is an alternative. Just registering app as VOIP app like Skype. OS does not keep the app running too, but will monitor specific socket port, and will wake your app when the socket receives some message. For more details, see here: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH5-SW15
In AppStore, an app using VOIP for other purpose like automatic update will not be passed, but you have no need to concern about it.
And other way to send message to device without running app is push notification. This is a feature supported in system-level. But this is not designed to commanding app. This is designed to send textual message. So If your app is not running, the message will be displayed to user. However, you can guide the user to start the app by sending push notification.
As a final option, you can request some feature to Apple for enterprise environment. If your company is big enough to get an enterprise license, Apple will consider your feature request seriously.
If you decided to use VOIP method, I'm sorry I can't help you any more. I have no experience of implementing this kind of app. But it should not so hard.
However hard part is server. It definitely require custom server program which keeps TCP/IP connection. Regular HTTP server cannot be used. Because HTTP itself is designed as not to keep TCP/IP connection. You have to build this kind of server yourself from scratch. You'll have to handle lower level TCP/IP transmissions.
There are a few solutions(both of free/commercial) for this kind of server, but none of are popular because this kind of server regularly needs full customization. So there's nothing to re-use or share.
However I believe this is most suitable implementation for your app.
If you can satisfy automatic update only when the app is running, you can archive it by polling server status from the client periodically.
This is easy to implement because you can use regular HTTP servers for this. Client connect and download recent updates from central server periodically. If there is a new update, just fetch and do what you want. And the app is launched, just check the update at first. Prevent all operation until update applied.
This is regular way. Most of applications are built with this method. In this case, you have no need to implement server or hard thing.
However applying speed of update is depend on polling period.
(Edit)
I couldn't care about private APIs. Because your app is not for AppStore, so you can use private API's freely. (This is different thing with jail-breaking. There are so many hidden features by excluded from documentation) I don't know about private APIs, but it's possible there is some API which enable the support for keep-alive of the app.
However, this reverse engineering work is so painful unless you're born to hack.
You may try to use the following open-source in your project:
http://code.google.com/p/cocoahttpserver/
https://github.com/robin/cocoa-web-resource/wiki
Apple has some sample code on their website that details exactly what you're looking for:
http://developer.apple.com/library/mac/samplecode/CocoaHTTPServer/CocoaHTTPServer.zip
So you have a couple options:
You could distribute your app wirelessly within your organization and push new content out as app updates. Apple provides this option to their Enterprise Developers.
Wireless App Distribution
iPhone enables enterprises to securely host and wirelessly distribute in-house apps to employees over Wi-Fi and 3G. Apps can be updated without requiring users to connect to their computers. In-house apps can be hosted on any web server accessible to users. Users simply tap on a URL to install apps wirelessly without needing to connect to their computers.
The alternative is you configure the app to fetch the updated data. You describe adding an HTTP server to the iOS device, but there's no way the server can receive data when the app isn't running. Given your needs, it would probably work better to embed a web client in your app instead.
If I was in your shoes (and option #1 didn't work), I'd use ASIHTTPRequest to check with a server at launch/daily. If there are new updates, the app could then either prompt the user that there are new data files to download, or it could just silently download them in a background thread.
UPDATED: Perhaps I should have been more explicit about how to do #2. You can configure the download so it isn't interrupted when the user quits the app (you don't need to do a Voip hack). Check out the Completing a Finite Length Task in the Background section in the iOS Programming Guide.
There are http server sample codes from Apple and open source community such as cocoahttpserver TouchHTTPD.
You can upload file to the http server on iphone.
Here's a blog and screen-shots about running cocoahttpserver and upload file to iphone.
The Python CGIHTTPServer allows you to create a server in 0 lines of code:
jcomeau#intrepid:~/rentacoder/bin2txt$ python -m CGIHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
Actually implementing a script to parse the input and save the file would take a little more effort.
[later]
OK, so forget about that, Apple doesn't allow it. See Local server on iPad for the iPad at least.