How to use Push Notifications - iphone

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.

Related

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).

Can I use local notifications for newsstand app subscriptions?

I have a newsstand app that will offer a free subscription that updates daily.
I would like to use push notifications to download the issues in the background.
At first I was considering use UrbanAirship to manage the list of scribers and send out push notifications every day at the same time. Of course this is costly.
Instead would Apple allow me to send local notifications to the app each day at the scheduled time and then the app could go and download the issue in the background, thus avoiding the need for a server to send push notifications or manage a list of scribers or worry about security and certificates etc.
I am not sure about Apple's guideline for this. But I strongly recommend to not try out something like that.
In case your app is not running (not in background) the local notification will not start the download automatically. The Newsstand push notification include the content-available property (with a value of 1) in the JSON payload. Due to this iOS launch your application in background (if not in background) and you can add your content in Newsstand queue for download in background. Once download is complete iOS will close your application. There is no notification alert or any other thing comes which require user to take any action. I think this you cannot achieve through Local Notification.
Other challenges
- How do you make sure the new content is always available when local notification is received .
- How do you figure out what content to download.
Also check out my answer to this question.

can we send messages to user even when the application is closed in iphone sdk?

i m making an application where data is accesed from website and displayed with an application.i have made an action which will tell the user that new data has arrived.this will work properly if the application is open .but if the application is closed than ,is there any way to tell the user that new data has arrived ,,so that he can open the application and check the data?
If you are using the Apple Push Notification Service (APNs), your messages will be delivered whether the application is running or not. For information on how to control what information is presented to the user, read the Apple Push Notification Programming Guide.
You should use Apple Push Notification Service, like codelark said.
I would recommend looking into Urban Airship for help getting started. It's a third party service, but it makes things much easier. Urban Airship does have their own tutorials and code samples which may be easier than Apple's.
As a follow up to the reference to apple push notification, as of ios4.0 I believe you, you may have a few more options, 1) you can send local notifications (just like push notifications, but they originate from inside your app) that could be timed to be delivered even if the app is not running..assuming you know approximately how long it will take for data to arrive. 2) if your data update will occur soon after the app closed.. your app can request a certain amount of time to complete an operation (even though the user has closed the app) and wait for the data, then send a local notification to tell the person to come back into the app. 3) if your functions based on gps updates, music streaming, or voip you can set a flag so your app continues to run in the background
sorry for the unstructuredness of the answer, this was just off the top of my head, hope it helps

How to show alerts from the application when it is not running?

I have an application in which I have to show the alerts for user specied reminders,
I am able to show these reminders when my application is running but my problem is
i have to show thsese reminders to the user when my application is not running?
is it possible to show the alerts or remindsers when the application is running?
what i obsered in iphone native applications(messages, emails) it whill show no of unread or new messages at the top right tip of the icon on the desktop and it will keep on updates these count.
Can I impplement these king of alerts to my applications? if yes how? it not is there any other to show the alerts when application is not running?
Have a look at Push Notifications. Otherwise this it is not possible.
You'll note that the applications that do this were all written by Apple. As of V3.x of the iPhone, no third party applications can run in the background.
The official way to support this kind of functionality is to use Push Notifications. This requires a server-side component. Push notifications allow you to update the "unread count" or display messages exactly as you describe.
Above both answers are right.
Actually, you can never ever display alerts when application is terminated.
Remember that "iPhone" doesn't allow any background processing.
The alerts that you see are push notifications - which are sent from apple server to iphone.
Basically you need to study about push notifications.
Push notifications are sent from server to iPhone only when it is registered.
( application registers for push notifications - which you can see in settings ).

iPhone real time notification from a server, without using Apple push notification

I'm looking for a way to get real time notification from a server in an iPhone App. I don't want to use Apple Push Notification as I have many notifications. My web service is coded in PHP, and I haven't figured out an easy way to implement this functionnality. Any idea what should I do?
Thx a lot for your help!
EDIT : I'm looking for a way to get notification only when the app is launched (otherwise, the only option IS Apple Push not.).
If the app is running you can open an http connection from the app to the server and have the server hold it open, pushing data through it when you want. This is basically how COMET works.
This will only work while your app is running. If you need the notification to happen even if the user has closed the app then Apple Push Notifications are your only option.
You must use Apple Push Notification for achieving push notifications cycle on Apple's mobile devices.