Silent push notification for certain user - ios

i have an application that receive push notifications, i would like to implement a user settings profile with a "silent notification for x hours".
How can i prevent the sound of the notification? there's a something on a server or in a client?
Because now i can prevent the sound if the app is in foreground or background, but if the app is suspended how can i intercept and lock the sound and the notification?
Somethings like whatsapp or telegram application!
Thanks!

Upload the user settings to the server and ensure that the server doesn't send any push notification during the silent hours. During that time if the user opens the app they should be able to download the content but they shouldn't be notified about any new content when the app isn't already open.

Related

Notify the app about remote push notification when the app is not running (terminated)

When app is not running (terminated NOT in background) and a remote push notifications is received, is there any way to inform the app about it so that the app can update something locally such as simple int counter?
I want to store something so that when the app is launched the next time, app knows that notification was received when app wasn't running and something needs to be done.
If user launches an app by tapping on a notification, obviously the app is notified about it through AppDelegate methods but these methods are never called if user launches an app by tapping on the app's icon.
To be aware of notification when user launches app by tapping on icon, i need some way to let app know that notification was received when app was in background.
There is no way you can achieve this with simple push notifications.
According to apple docs if the user has manually killed your application by swiping it out of memory, your app will never be started in the background to process data until after the user chooses to launch it again.
One solution to this problem is using VOIP push.
According to apple docs -
Your app is automatically relaunched if it’s not running when a VoIP
push is received.
But you need a strong reason for using it and apple may ask that before approving your app on the app store.
To read more about VOIP push please go through this doc - https://developer.apple.com/library/content/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html
You can also be used the "Silent Push Notifications".Which are confirming that their is something available on the server, which you need to download to your app,The payload format of the Silent push notification is like
{ content-available:1 }
The Best part of the silent notification is that they do not notify the iPhone user
Here 1 is for their is something available to download from the server.
here below i have attached the apple's silent notification slide.
Your App is getting Refresh in the Background.

Suppress/Hide push notifications in iOS when the app is running

I receive push notifications on certain events from a notification server we have.
I do want these notification alerts to appear when the app is not active in the background/foreground
I don't want the notification alert to appear when the app is active in the background (foreground not a problem since the notification doesn't show anyway). I want to show my own local notification, only.
Is there any way to do this from code? Basically I want to hide the remote push notification and instead show a local notification when my app is active.
P.S - The notification server sending silent notifications is not an option - the server does not know when our app is running/not running. There is no communication between the app and this server.
You can notify your application first and then show a local notification with that. To perform this you can simply send content-available notification from server. This makes your app notified and then you can decide on showing local notification or not.

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.

How can i store iOS remote notification when app in state background or killed, and without tap the notification?

I want to save all the notifications from server.Is that only way is to request server to get all messages?
You may use silent notification feature which lets your app do simple operations (e.g. purchase sync or file sync) without bothering the user or having the user open the app.

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