How to remove new Notifications from banner? - ios

Is there any way to handle remote notification payloads before they’re delivered and display in notification centre?

With push notifications of default type there is no way to filter out notifications if the app is not in foreground.
The possible solution to this is to use VoIP push notifications in conjunction with PushKit.
VoIP pushes are always waking up the application, however they are not presented to the user and don't modify app badge value, so it's up to the developer to show a local notification upon the received VoIP push and to deal with app badge.
There is a technique with additional silent push that for example Facebook is using, to delete notification on iOS device when the message has been read on desktop web site. It's described here: https://www.pushwoosh.com/docs/deletable-ios-push

Related

Can i receive messages with FCM without notification permission?

I want to know if I can receive payload from FCM in my iOS app, even if the user doesn't allow notifications for my app. I don't want to show them as notifications, i just want to handle their payload.
Does background messaging work without permission?
Does foreground messaging work without permission?
The Firebase Cloud Messaging APNs interface uses the Apple Push Notification service (APNs) to send messages up to 4KB in size to your iOS app, including when it is in the background.
Notification permission is required for both background and foreground work (even if your push notification is a silent one i.e no notification needs to be displayed)
You still need the user to allow the notifications, later on, you can implement the handling as silent or not, up to you.
In order to receive the payload you need, it must come from a push notification.

Is possible use silent push to wake up APP and get the VOIP call?

if My app works at background, can I use silent push to wake app and get the VOIP call?
I used "jpush" to post a silent push which can work when connecting my idevice with Xcode and run APP.
If my idevice doesn't run APP with Xcode, I can not receive the silent push at background (only receive at foreground.)
Is it possible to use silent push to wake up APP and get VOIP call?
Did I get something wrong??
Yes. If your application does VoIP calling then it's possible to use PushKit:
Overview
The PushKit framework sends specific types of notifications — such as VoIP invitations, [...] — directly to your app for processing. [...]
Unlike user notifications, which are supported by the UserNotifications framework, PushKit notifications are never presented to the user — they don't present badges, alerts, or sounds.
PushKit notifications offer the following advantages over user notifications:
If your app isn't running, the system automatically launches it upon receiving the notification. [...] For more information, see Local and Remote Notification Programming Guide.
Your app is given runtime to process the notification, even if it's running in the background.
[...]

Is there a way for the App to change notifications into silent notifications (not server) for push notifications

I was wondering if it is possible for an App to turn a push notification that isn't silent(plays sound) into a silent push notification (doesn't play sound)? From my research it seems that only the server can change non silent notifications into silent push notifications.
It's unfortunatly impossible.
The advantage of the push notification is that it can be presented to the user event if the app is not running.
The drawback is that your application is not told about push notification receiption. Thus, you cannot modify it in the app.
Another solution would be to use background fetch to ask your server for notifications, and then to programm UILocalNotification with/without sound.
But doing this, your notifications would't work while the app is not running

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.

iOS Push Notification policy

I'd like to implement a push notification service in my iPad app. But before I do that I have to know further details about its contraints.
I know that the user has to accept the apps notification ability. But is that only for notifications which come in when the app is in the background or also when the app is active?
A user doesn't need to accept the ability to allow Push Notifications but they can turn them off from the Settings app. This will turn off all incoming push notifications if the app is in the Background. If your app is running:
If the application is running when the notification arrives, no alert is displayed or icon badged or sound played, even if (in iOS) the device screen is locked. Instead, the application delegate is informed of the notification and can handle it directly.
You can find loads more information on Push Notifications in Apple's Push Notification Programming Guide

Resources