I'm looking for a way to set up an iMessage after a user clicks my app's notification. Is there any way to do it directly, or would the notification have to open my app and then open MFMessageComposeVC? If I can only do the latter, how can I distinguish the user opening my app from a notification vs from clicking the icon? Could I pass information into my app, such as who to send the message to?
Thanks in advance.
Is there any way to do it directly, or would the notification have to open my app and then open MFMessageComposeVC?
No, it will have to open your app first which in term will open MFMessageComposerVC.
If I can only do the latter, how can I distinguish the user opening my app from a notification vs from clicking the icon?
Yes, if the user opens the app from the notification, the application:didReceiveRemoteNotification will be executed. If the user opens in the traditional way, the application:didFinishLaunchingWithOptions will be executed, the launchOptions dictionary will contain your notification info.
Could I pass information into my app, such as who to send the message to?
Yes, you can pass information to your app through Push Notifications.
For further information, you you can refer to this tutorial,which even though is for iOS 6, it explains how Notification work and is a good starting point for you.
Related
Im developing an app that uses Ibm Mobile First Push Notification on iOS.
My question is how do i detect the app is open or navigate to, when user click on the notification banner at notification centre?
I know WL.Client.Push.onMessage does the trick. But this function is being fired too when the app is at foreground and a notification is received.
Is there a different function?
Thanks in advance.
In all cases (app closed, opened, etc...), there is a single function/callback that is called to process the incoming notification.
If I understand your scenario, you want to perform a different action with the notification, depending if the app is opened or not? Perhaps you can resolve this by setting boolean flags during runtime or assign "IDs" to the various app screens and check for the values of these and act upon them accordingly?
I cant find a clear answer about this in the Titanium documentation. Is it possible to directly respond to a push notification while the app is killed ?
I know that the callback is called when you open the app trough the push notification. but is there a way to respond when the app is opened manually ?
I tried to use remote-notification as UIBackgroundModes, but this only helps for paused apps.
My goal is to show the push notification in a in-app message center.
You should never rely on push notifications to deliver you payloads, they are too limited for that. If the user receives 5 push notifications and opens the app via the app icon, you will never receive any of the payloads. If he opens the app via one of those notifications you will only receive that payload.
You could use silentpush:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Background_Services-section-37539664_iOSBackgroundServices-SilentPush
But the app should always query a back-end to get the actual data. That's how WhatsApp does it as well, as you can see when you open it via a notification it will then still fetch the message(s) form the server.
I am creating an IOS application that makes use of PUSH notifications. When I send a PN, I send data to my application. IF my app is not active, I can then click the notification in the notification center to update the data in the app. However, IF I do not click the notification and I just resume the app via the launch screen, the app does not update correctly. Is there a way to update the apps pending notifications even if I don't press the notification center button and I just resume the app from the launch icon?
I have been scouring the internet with no luck. I have also tried to put the notification in a NSMUtable Array in the application delegate with no luck.
thank you in advance.
Without you having a list of notifications that the app can download from the server you won't have a consistent solution so that is the best bet.
If you turned on background fetch for your notifications then the app could maintain a list of the received notifications, but this approach would fail for any notifications coming in after the user had force quit the app.
When the app is in foreground and it receives a notification, the alert message is shown and it only has an "OK" button, no "Cancel". So the user can't really say: "I want to ignore this message".
Yet, I do need to give users the ability to ignore the notification. They contain a deep link and the user might not want to be taken to another page if she is reading something else.
To do this I implemented a custom alert saying: "Do you want to be taken to this article? Yes / No" and only if "Yes" is chosen the user is taken to the deep link.
The problem is I don't know how to find out when the standard alert has been closed. So I show my custom alert in didReceiveRemoteNotification which results in two alerts overlapping (bad).
What is the recommended solution to give the user a chance to ignore a notification when she is already in the app? Is there a way to customise the default alert message when the app is in foreground?
When your app is in the foreground iOS does not handle the notification. It is directly delivered to your app and your app is handling the notification.
If you have two dialog them most probably your is presenting them both.
This is stated in Local and Push Notification Programming Guide
If the app is running in the foreground when the notification is delivered, the app delegate receives a local or remote notification.
As the doc said, the app delegate will handle the notification.
In one of my application I want to handle email/call/sms notifications. How can I achieve the same also how can I get the list of available notifications in iOS?
You can't, there is not API that allows you to do this.
When a user click on a notification you app is informed only about the notification that the user clicked on. You are not able to see if there are any notification for your app, let alone for any other app.