can i implement an app that have 2 types of notification (Remote and newsstand notification) - iphone

i need to know if i can implement an app that can handle 2 types of notifications
Thanks

Both remote and local notifications enable an application to inform its users that it has something (information) for them - in a form of a notification (It could be a message, an impending calendar event, or new data on a remote server), when the application isn't running in the foreground.
When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.
The difference between the two are:
Local notifications are scheduled by an application and delivered by iOS on the same device. Local notifications are available in iOS only.
Push notifications, also known as remote notifications, are sent by an application’s remote server (its provider) to Apple Push Notification service, which pushes the notification to devices on which the application is installed.
Push notifications are available in both iOS and, beginning with Mac OS X v10.7 (Lion), Mac OS X.
Going back to your question, the answer is YES.
As per discussed in the Apple documentation:
To have iOS deliver a local notification at a later time, an application creates a UILocalNotification object, assigns it a delivery date and time, specifies presentation details, and schedules it. To receive push notifications, an application must register to receive the notifications and then pass to its provider a device token it gets from the operating system.
When the operating system delivers a local notification (iOS only) or push notification (iOS or Mac OS X) and the target application is not running in the foreground, it presents the notification (alert, icon badge number, sound). If there is a notification alert and the user taps or clicks the action button (or moves the action slider), the application launches and calls a method to pass in the local-notification object or remote-notification payload. If the application is running in the foreground when the notification is delivered, the application delegate receives a local or push notification.
For further understanding, read more about Local and Push Notifications.

Related

any option to know if apple app get the push notification?

I build xcode app that get push notification, the main problem is that the push notification is very critical for me.
so I want to check if the push notification is delivered to the device with the app installed, I understand that if the iphone dosn't have internet connecction / 3G the push notification is not getting to the device.
how can I check if the device get the notification or not?
how can I check if the APNS successful to deliver the push notification?
I want to send sms if the push notification is not deliver to the device so I think about the idea to get the notification event when it's open by the push notification, and to send request to my server so i can know if the push notification is successful deliver or not. the main problem is that the user need to open the app every time he get the notification and in the night it's a problem. so this option is not good for me.
I check the feedback server push notification but i don't find any info that I can get if the push notification is delivered or not
any idea??
With iOS7 you have a new method called
application:didReceiveRemoteNotification:fetchCompletionHandler:
which you probably could use for your task. From Apple's Docs:
Implement this method if your app supports the remote-notification background mode.
...
When a push notification arrives, the system displays the notification to the user and
launches the app in the background (if needed) so that it can call this method. Use this
method to download any data related to the push notification. When your method is done,
call the block in the handler parameter.
Unlike the application:didReceiveRemoteNotification: method, which is called only when
your app is running, the system calls this method regardless of the state of your app.
The short answer, you can't, since APNS is one way. However, since an app can execute arbitrary code upon receipt of a notification, you can use this to say, send an http request to your own server when the notification is recieved.
There are any number of reason why push notifications might not get delivered to your user, or might not be delivered in a timely manner. Apple does not provide any mechanism for you to query the status of a push notification that you have sent.
If your app is currently running on the user's device and the user is accepting notifications for your app, you can implement the following method in your app delegate. It would be called whenever a push notification is received and in this method you could send a request back to your server to indicate the message was received. However this will only work while the user is running your app.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
In general though, it sounds like you'e relying on push notifications for something you shouldn't. From Apple's Local and Push Notification Programming Guide:
Important Because delivery is not guaranteed, you should not depend on
the remote-notifications facility for delivering critical data to an
application via the payload. And never include sensitive data in the
payload. You should use it only to notify the user that new data is
available.
There is no way to find out whether the notification was delivered to the device or no. APNS is a one way service. If there is no internet connection on the device then the APNS server will hold the last notification for some period of time which is no specified by Apple. If a new notification is sent to APNS for delivery then the old notification data is lost and replaced by the new data if its undelivered. If the notification is delivered then also the old notification data is deleted on the APNS server.
Please go through the following link : Apple Push Notification
Hope this helps you...........
If you are using JAVAPNS to send the APNS notification, you can use the below:
List<PushedNotification> notifications =
Push.combined("alert", badge, "default", "cert.p12", "certpassword", true, deviceToken);
for (PushedNotification notification : notifications) {
if (notification.isSuccessful()) {
//Push is successful. Do your thing...
}
else {
//Push is not successful. Do your thing...
}
}

How can I control the Apple Push Notifications I receive

I have successfully created a server that sends Apple Push Notifications, and my iphone receives them.
For example I have Notification of type A and notifications of type B,
How can I control the types of notifications I received on the iphone side? For example I only want type A and not B (Just like Facebook, I want notifications for Friend Request, but not for Walls)
Thanks
you cannot stop your device on receiving a specific type of notification unless it is done on server side. Though you can ignore a notification when app is in running state as you get the notification in didReceiveRemoteNotification and you can simply ignore it after checking it but if app is in background or it is closed then you cannot control the incoming notifications from within your app.
you can make a service on server to set preferences for notification types.
from device, user can enable/disable the push service for individual features and update the preferences on server from device.
On server, before sending the PUSH, you can check for the preferences selected by user from the table and send only those notifications which the user has opted for.

Not all iPHone push notifications delivered to iPhone

I am developing iPhone application, application registered for receive push notifications.
I send push notification to gateway.sandbox.push.apple.com from server,all ok, but sometimes push notifications not delivered to iPhone (size of notification message is correct, < 256 bytes). Why? Maybe exists limitations for iPhone sandbox(for example count notifications in one hour) ?
There is no guarantee of delivery of push notifications. In addition to other potential causes consider this section of the Local and Push Notification Programming Guide
Quality of Service
Apple Push Notification Service includes a default Quality of Service
(QoS) component that performs a store-and-forward function. If APNs
attempts to deliver a notification but the device is offline, the QoS
stores the notification. It retains only one notification per
application on a device: the last notification received from a
provider for that application. When the offline device later
reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting
it.
If a device is offline (either turned off or just unreachable) then it will receive at most a single push notification you attempt to send to your application during that time.
Sometimes the fault is on your network provider which is unable to deliver notifications.same problem i was facing with my device when it was connected to wifi, When I connected it to 3g network all notifications were received instantly.

Is Apple's push notification service reliable?

I have an iOS app using push notification but once in a while I'm not getting a notification on my device when I expect to receive one. I would receive all the subsequent notifications. I confirmed with my backend to make sure that all the notifications were sent successfully.
So my question is: is APNs nearly 100% reliable or should I just expect to miss some notifications here and there because of intermittent 3G/wifi connection?
I would think that APNs works as a queueing system and retry if it wasn't successful within the first few times.
The APN service will queue messages up -- but Apple doesn't guarantee delivery of all messages. Only the last message from an application will be kept in the queue when the user is offline. Additionally, old messages may be deleted.
Local and Push Notification Programming Guide
Apple Push Notification Service
includes a default Quality of Service
(QoS) component that performs a
store-and-forward function. If APNs
attempts to deliver a notification but
the device is offline, the QoS stores
the notification. It retains only one
notification per application on a
device: the last notification received
from a provider for that application.
When the offline device later
reconnects, the QoS forwards the
stored notification to the device. The
QoS retains a notification for a
limited period before deleting it.
I have an azure website (and mobile service, service bus, db, active directory etc) that sends push notifications to a xamarin app on a windows phone and an iphone. The first notification is received by both. The second notification is only received by the windows phone, it doesnt make it to the iphone. If I send another notification, it is received by both. So I investigated the behaviour at bit more and found that if I machine gun a series of notifications (hand typed one per 2 seconds) the windows phone received them all but the iphone only receives the first one. But if I wait a while and send a notification it is received by both devices. The next test is to see if the notifications are always received with a 5 minute gap. Sent two messages with a five minutes gap in between, both windows phone and iphone received both notifications.

push notification - background process - iPhone

I have just heard that - " push notification " is possible in iPhone
I need following details.
what is push notification ?
How it works ?
What does it requires ?
Any sample code link is available ?
Any documentation link if available ?
Some guidance/tips from "StackOverFlow Masters" about developing the above requirements.
Thanks in advance for sharing your knowledge with Stackoverflow family & me.
The sort of background processing you're looking to do is not possible with push notification.
Push notification allows you to notify the user of something. An example would be a Twitter client that sends a notification when the user receives a direct message on Twitter.
Push notification can not react to things happening on the iPhone when the app is not running. Instead, it depends on you having a server that determines when to send a notification and then sends one.
I'm not seeing any need for background processing in your application. If you store the user's initial location, the next time the app loads you can get their location and calculate the distance between the two. If you're looking for the route travelled, you're out of luck unless you make a deal with AT&T like Loopt just did.
Push notification is not really for that purpose, you should read up on push notification in apples site here http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html, its more for when theres data like a m essage for your user, you can have the user get it without having them open t he application. Now for your purpose, why cant you store the location when htey close the app, once the reopen the app you can reget a location, use the previous location and the new location to calculate the km travelled?
Although only tangentially related to this discussion, I think you might be interested in Loopt's agreement with AT&T to track user's iPhones (for a monthly fee).
Apple Push Notification service (APNs for short) is the centerpiece of the push notifications feature. It is a robust and highly efficient service for propagating information to devices such as iPhone, iPad, and iPod touch devices. Each device establishes an accredited and encrypted IP connection with the service and receives notifications over this persistent connection. If a notification for an application arrives when that application is not running, the device alerts the user that the application has data waiting for it.
Software developers (“providers”) originate the notifications in their server software. The provider connects with APNs through a persistent and secure channel while monitoring incoming data intended for their client applications. When new data for an application arrives, the provider prepares and sends a notification through the channel to APNs, which pushes the notification to the target device.
Check this link clearly explained Apple push notification services
http://mobiforge.com/developing/story/programming-apple-push-notification-services