Listening for events - iphone

i wish to PUSH an XML File from a windows PC to the iPad,
how and what should i do so that the app can "listen" for events like that.

See the Local and Push Notification Programming Guide.
You can only use push notifications to play alerts, display a message, or badge the application icon.
Anything more, and you have to take the client/server approach where the the apps must be running on both ends. A mix is usually best. Push a notification of something, which in turn can fire up the client, which in turn can download the latest chunk if structured information in XML (or whatever) form.

Related

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.

iPhone App that stores data from the web

I'm making an iphone app that uses NSURLConnection to download some data from the web. I need to store this data somewhere, so my app can send out push notifications when the data changes in a particular way. For example, the data being stored is a number and a push notification will be sent out when that number changes by +-10.
I'm new to this, so I'm probably overcomplicating how I think this can be accomplished. I'm thinking I need to create a database and some server-side code that continuously pulls the data. When the data changes to my specifications (ex. +-10), it somehow pushes the data to the app which then sends out a push notification.
Is there an easier way to accomplish staying within xcode dev?
The app doesn't send the push notification. The point of push notifications is your app can be in the background so it can't poll/check for a given condition (like your +-10).
When that interesting even happens server side, it can push a notification to the device. The device can handle that notification by (1) showing text (2) playing a sound or (3) updating a badge on an icon.
So, it's not about your device downloading the data into database (although that has value for offline and occasionally connected scenarios).
So, you'll need a server side component that detects that +-10 change (on data change or polling) and then sends the push to the device. Now, it's possible that devices are sending data to your service (uploading) and when and interesting event happens it could notify other instances of the app.
This link may help clarify push notifications: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

How to build a simple notification application as non-developer?

I want to build an iPhone app - the entire purpose of which is to send push notifications.
In this case it'd send one quote from a famous person a day. The interface would just be a preference screen where you can control what time of day you'd like the notification to be sent, so it's pretty bare bones.
I don't really have the development chops to write it from scratch so I was wondering if there's an ideal platform, app-builder, or whatever to create it with.
You might want to try www.elance.com
The application itself will be easy to implement. But the other part is the Pushing application which will be sending the messages.
Check this tutorial here, Programming Push Notification Service
You might not necessarily need push notifications; if your quotations can be stored on the device, you can show them using local notifications instead.

Retrieving latest Push Notification if app was not launched by hitting the 'View' button

I'm wondering if there is any way of retrieving the last-received push notification if the app is launched from the home screen instead of by pressing the 'View' button on the notification.
The app we're writing is for dealing with sensitive data, and it's important to be able for the central server to be able to remotely disable a client at will, without having the requirement that the app needs an internet connection to launch.
The basic idea I came up for this would be to send a push notification with a custom payload letting the app know to disable itself until it can properly sync its data.
This would work if the user pressed View on the notification, but not if they cancelled it and then launched the app separately.
I'd love to know if this is possible, or otherwise if there's a better way to implement this functionality.
It's not possible. Your app would have to connect to the server on launch and get its latest status from there. If your use case is that sensitive, push notifications are probably not reliable enough anyway because Apple does not guarantee that a push notification will actually be delivered.
Like Ole said, not possible.
Note that you shouldn't be relying on push notifications for anything like this. From Apple's push notifications programming guide:
Remember that delivery of notifications is “best effort” and is not guaranteed.

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