iphone - How does Whatsapp separate notifications? - iphone

Im about to develop notifications for my app.
In whatsapp you can receive group messages or single messages, and you are able to block one or the other type of notifications with in the settings of the app, not in the general settings of the phone, where you can disable any notifications.
My app will receive different types of notifications, the user should also be able to block notifications of one type and enable others.
What I don't understand is how my app or whatsapp is able to distinguish the different types of notifications, from what I know the notifications are handled by the iOS, so could you explain me how this can be done?
thanks

I assume you're talking about push notifications, so:
They'll be being "blocked" on the server. i.e. the server will only be sending out notifications for the types that you've chosen. You can't do it in the app.

add a type field in the dictionary.
then have a bool key for each field in userpreferences for example
then once you have recived the push pull the type field and check the bool in settings
if YES or setting for that key is missing process the notification in the app.
if user opted out of that subtype of notification then don't do much, maybe
just update badges (if any). but don't pester user with any other disruptive
in app navigation, etc
obviously you have to build a table view controller to allow user select which subtypes
of app-specific notification she should be bothered with (probably opt in by default
for most of them)

Related

Flutter Notifications Panel

I'm using with success the flutter local notification plugin. Now I'm struggling for create a page with all notifications.
Is there a way to collect all incoming local notifications of my app (even if dismissed and/or not clicked) in a list (the classic notification page like FB etc.)
I only notice that I can track the tapped notification but not only the arrival notification.
Thanks!
This unfortunately is not possible, because notifications are not stored anywhere. They exist in memory on the device, until the user dismisses them, or they are replaced with a message of a similar ID, or the OS just removes them altogether.
Your best bet, is to generate a table on your mobile backend, that will store these notifications (the same ones that will be broadcasted to the users notification center), then get the app to read directly from this table, and store it on a local SQLite database.
These notifications that are broadcasted, will need to be sent from the backend itself, with the exact same content, as that being stored on the table I mentioned. This will ensure data integrity between the notification center, and that of the app.
[EDIT]
Please make sure that you use FCM (Firebase Cloud Messaging) for mobile push notifications. These are completely free, as per the documentation:
https://firebase.google.com/docs/cloud-messaging
For Tutorials, please look at these:
https://medium.com/#jun.chenying/flutter-tutorial-part3-push-notification-with-firebase-cloud-messaging-fcm-2fbdd84d3a5e
https://www.freecodecamp.org/news/how-to-add-push-notifications-to-flutter-app/

Send push notification to specific user?

I'm making an app where I want to be able to set a basic notification (title, message, fire date) and have been trying to figure out the best way to setup the notifications. I'm working with Swift 3 and Firebase 3.
I don't want to use local notifications because if the user is logged in on multiple devices I want it to push to all those devices.
Is there a way to do this with FCM where a user can set a notification to fire at a specific date and time and have it fire on all (iOS) devices logged in?
If FCM doesn't have this, is there another APK that does? I've looked at Batch briefly but I'm already using Firebase.
Thanks in advance!
If your main use case is to send a push notification to a single user for his multiple devices, I suggest you make use of Device Group Messaging on iOS. As per the docs, it is typically used for:
With device group messaging, app servers can send a single message to multiple instances of an app running on devices belonging to a group. Typically, "group" refers a set of different devices that belong to a single user.
When it comes to sending the notification on a specific date, I'm pretty sure you can set it up in the Firebase Console.
However, if you intend it to be sent from the server, you have to implement it yourself, since I think, there is no currently API available or a parameter you can set in the payload that can be modified for the message to be sent for a specific date.

Can I delete a push notification from a device which have receive this push notification?

I have the following problem.
I look for a capability to delete a push notification from a device (iPhone respectively Apple Watch) but this device have receive the push notification.
The use case is that a USER A send a request to all available USER Bs. A push notification is send to all these USER Bs. At the moment the push notification arrive it will shown on their Apple Watch. One of the USER Bs answer that he accept this request. After he press the button to accept the request the notification should be deleted on all the other devices.
I really do not know a capability to do this.
But I know that you can handle this problem in Android as provide a unique ID for this notification. After that you can delete the other notifications with this particular ID.
Is their maybe a same way for iOS like it is provided in Android?
This doesn't really have anything to do with WatchKit/Apple Watch.
To answer your main question: no, you can't do this as it describe. Once you fire off a notification, it's in the user's hands to decide what they want to do with it.
As an alternative, you could maintain an "inbox" with every notification in your app and use the notification to prompt the user to check it. That way you could remove a notification from the inbox on the server side of things.

How can I control the Apple Push Notifications I receive

I have successfully created a server that sends Apple Push Notifications, and my iphone receives them.
For example I have Notification of type A and notifications of type B,
How can I control the types of notifications I received on the iphone side? For example I only want type A and not B (Just like Facebook, I want notifications for Friend Request, but not for Walls)
Thanks
you cannot stop your device on receiving a specific type of notification unless it is done on server side. Though you can ignore a notification when app is in running state as you get the notification in didReceiveRemoteNotification and you can simply ignore it after checking it but if app is in background or it is closed then you cannot control the incoming notifications from within your app.
you can make a service on server to set preferences for notification types.
from device, user can enable/disable the push service for individual features and update the preferences on server from device.
On server, before sending the PUSH, you can check for the preferences selected by user from the table and send only those notifications which the user has opted for.

access user push notification preferences/permissions in the iPhone using objective c

we are looking for a way to find out (not modify, just find out) if our application has been allowed to receive notifications or not from our service. This probably requires read-only access to the "general settings" properties or some specific API's. Does anybody know how to get that information? I am talking about the info in iPhone --> Settings --> Notifications
For those who are interested, this is the rationale:
we are having some issues with users pressing NO when asked to allow our application to receive push notifications. As you can imagine, users might just press no because they are racing through registration or because they don't quite understand what is happening, or simply because they are not too sure whether they should allow the application to get notifications. But then they forget they denied permission so file support requests because they don't receive push notifications.
Call -[[UIApplication sharedApplication] enabledRemoteNotificationTypes]. From the docs:
The values in the returned bit mask indicate the types of notifications currently enabled for the application. These types are first set when the application calls the registerForRemoteNotificationTypes: method to register itself with Apple Push Notification Service. Thereafter, the user may modify these accepted notification types in the Notifications preference of the Settings application. This method returns those initial or modified values.
-enabledRemoteNotificationTypes is deprecated.
It is recommended that you use the simple boolean instead:
[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]