IBM MobileFirst Platform 7.1 Push Notification behaviour - ios

I am developing application for IPhone in IBM Mobilefirst Platform 7.1 with Push Notification feature. I am sending the push notification based on the User ID.
Using adapter based authentiation, I am retrieving the User ID and subscribing to Push Notification based on the User ID.
The push notification behavior in my app:
Login and subscribe to push notification
Logout
Send Notification [ When app is in foreground ] - Successfully received and processed
Send Notification [ When app is in background ] - Successfully received and processed
Send Notification [ After killing the app running in background ] - Successfully received but can able to receive the notification content
and process it only after login ( i.e. pushNotificationInvoked
function is triggered with payload only after login)
Now, the point is, when the app is in foreground and background we can able to receive and process the notification regardless of the user is logged in or not. Then why do you need to login, on click of received notification when app is not running in foreground or background.
Is this the way MFP is handling the notification? or is there anything that I am missing here?
Thanks in advance.

Only once the user has logged-in, you can associate the notification with the user, without this you may display private data incoming with the notification to users who shouldn't receive it, since multiple users can potentially use the device.

Related

iOS push notification to remove delivered notification

I'm working on a app project that uses react-native and FCM Push Notification (rnfirebase 5.6.x).
I send a notification when the user receives some message and I need to remove that delivered notification if the user reads that message on another source (like our web app).
With the app open or in background, I can send another push with some userInfo to let me know what I need to remove.
Everything is working perfect... Except when the user kill the app. Then I have no control on the received notification...
I tried the use the tag prop on the notification data, but according with firebase, it is for Android only.
Any ideas on how to do that?

GCM not sending notification when App ios shutdown

I'm using GCM to send notifications to both android and IOS devices.
On IOS, the notifications are received while application is active or running in background.
However, when the application is down, no notification is received.
I tested by contacting directly APNS and the message is received. So the configuration on the device seems Ok.
Here is an example of a message sent to GCM:
{"notification":{
"badge":"4",
"body":"Test body",
"sound":"default",
"title":"Test title"
},
"collapse_key": "collapse_1",
"message_id": "1000003",
"content_available":true,
"to": "GCM TOKEN FOR DEVICE"
}
This message is received correctly when the application is in background but not when the app is shutdown.
I've sent the supposed message that should be sent to APNS, directly to APNS:
{"aps":{"alert":{"title":"Title","body":"Body"},"badge":5,
"sound":"default", "content-available":1}}
And the device receives this notification.
What am I missing? Is there a specific configuration to authorized GCM to send to APNS?
Thanks a lot, because I'm stuck.
Michael
Foreground pushes (i.e. those intended for the user) are always displayed. Background pushes (i.e. those intended for the app) are not sent to the app if the app has been killed.
Your push payload doesn't know what it is - its a mixture, it has a body/title/sound which a foreground push would have, but it also has content-available which is for background pushes.
Decide if your push should be a foreground or a background push and then chop out the unnecessary parts from your payload accordingly.
Also starting with iOS 8.1 (or 8.2 I forget which), background pushes will only instantly be delivered to the app if the app is in the foreground or if its in the background and the device is being charged (note, this included being connected to a mac via usb).
If the app is in the background and its not being charged then it might take several hours for the push to get delivered to the app.
If an iOS Application is killed from the switcher by the user, it will not receive push notifications. This is an OS thing that Apple deliberately implemented so there isn't a work around.
More info can be found here (login required): https://devforums.apple.com/message/873265#873265
we encountered this issue while trying to send messages to GCM topic, all android devices get the message correctly but not the ios ones where app is killed. Solved issue with sending message both in data and notification objects. Don't forget to put priority to high!!
Sample Json:
{"to":"/topics/xxx",
"collapse_key":"",
"data":{"message":"topic notification"},
"notification":{"body":"topicotification"},
"time_to_live":3600,
"content_available":true,
"priority":"high"}

Callback function for push notifications while app is killed (titanium iOS)

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.

Apple push notification-like service, only when running in foreground

I have an iOS app that needs to update its content while running in foreground automatically. My app does NOT need to update if in background.
There is a existing way to do so, which is APNS(Apple Push Notification Service).
Because I don't want users to see notification message while in background, using push notification without alert or message might be a solution.
However, if using APNS, iOS would ask users to confirm if they want to receive notifications by my app. I think that users may be confused when being asked by the OS since my app does not actually push notification to users.
The current method I use is keep pulling my API every 30 seconds to see if new content is available. This method would fail if there are too many users.
Is there any 3rd party push-notification-like service that provides notification while app runs in foreground only? (no need to get notification while in background)
You can use Silent notification for that, in this
In the WWDC 2013's "What's New with Multitasking" presentation, there is a section about Silent Push Notifications. if you send the APS payload with just the content-available set to 1, users will not be notified of the notification.
And the notification arrives in application:didReceiveRemoteNotification:fetchCompletionHandler:
Your payload is like
{
aps: {
content-available: 1,
sound: "default"
}
}
In case of push notification, it is necessary for user to accept push notification on application 1st run. You can set a silent push notification also and for this user will not get any alert of getting a notification during application run loop.
If you want to avoid push notification, then you can only set a NSTimer that you are doing already.
There can be a 3rd case, Application only sync with the server when it comes to foreground. And for this you can refer to my this post.

How to check if there is a new e-mail in background - ios

how can I check if there is a new email and show an alert to user when my app is running in background?
For pushing a notification when app is not active I have to set a "show" time to notification but an email can be received any time... I need to check emails when my app is not active?
You should use the Apple Push Notification Service to send push messages when your server detects there is a new message. Your app on the phone should not do this as it will run down the battery quickly.

Resources