How do you clear the notification center in Titanium for iOS? - titanium

I have basic push notifications sending to my application. I was wondering if there was a way to clear the notifications in the notification center when the app is opened?

There You may use Ti.UI.iPhone.appBadge = 0; to reset the appBagde in the device. From 3.x, Appcelerator has added a new functionality to reset the badge on Appcelerator server.
Cloud.PushNotifications.setBadge() method allows the user to set the badge and Cloud.PushNotifications.resetBadge() will reset the badge in the notification center.

Related

Saving all push notifications data got for an app when app is in terminate or inactive state

I'm new to iOS development and currently i'm working on push notifications.I have a requirement where I will get push notifications for different functionalities in an app. When app is in terminate or inactive state all notifications will display in system notifications panel. When I tapped on particular notification remaining notifications data is lost. Is there any thing like we can store all push notifications data and when launching we can execute one by one.
No, not on iOS.
Apps like facebook do this by keeping the state of the push notification on there server. Thus allowing a client to fetch the alerts and show their read state.

Updating notification badge after dissmissing notification from Notification Center

My app uses Local Notifications. There are situations when more than one notification is scheduled and at some point displayed. When notifications are displayed badge number is updated automatically. When user clicks on one of the notifications I manually decrease badge number and cancel the notification.
The problem starts when user manually dismisses notification from Notification Center. The badge number is not updated. There are situations when there are no notifications displayed in Notification Center and badge shows a number. User is not able to clear the badge.
Setting the badge number to 0 (instead of decreasing it) after clicking on one of the notifications is not an option because it causes all notifications to disappear from Notification Center.
Is there a good way to resolve this issue?
Is there a good way to resolve this issue?
No.
Your app isn't notified when a user dismisses the local notification. Only push notifications can set the badge number when your app isn't running.
The badge is intended to represent the internal state of some data in your app that you control. There is no way to make it always match the number of items in the user's notification center. This is also why you get no notification if the user cancels your local notification.

Detect when a user clears notification from the notification center

My app needs to know if a user deletes/clears the apps notifications from the notification center using the clear button.
Is there either away to detect when the user removes the notification from the notification center or grab an array of notification on the notification center?
You (ie App) cannot interact with NotificationCenter, NotificationCenter interacts with the user. A user can choose not to receive any push-notifications.
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html

How are push notifications displayed on iOS 4?

I was wondering how push notifications were displayed on screen for iOS 4? Since there is no notification center (iOS 5) will the push notification instead automatically be displayed as an alert or must I implement this myself?
Thanks
The code/logic to implement to send "message" push notifications is no different in iOS 4 vs iOS 5. the only difference is the appearance to the user which is a UIAlertView style notification with a "Go to App" button and an ok button. Also be aware there is no notification center that will keep track of old notifications.

ios5 notifications alert style

Is there any way to set the alert style for notifications via programming in ios5?
My app uses notifications that have actions and I do not want to put those notifications as banners. The flow of the app is dependent on the push notifications that arrive.
So I was finding a way by which I could set the alert style of the notifications to "Alerts" rather than "Banners". Any way to do that?
No, your app cannot control this. It is up to the user to decide how he wants your notifications to display. But why does it bother you? Clicking on the action button (aka "View") or clicking the notification itself in Center is similar in behavior regarding your app's code.