How to aggregate iOS push notifications using Parse - ios

so I'm developing an application where a user might get a notification based on some action but I only want the user to receive one notification of a specific type. An example might illustrate this better:
Say a user on facebook makes a facebook post. If someone likes the post they'll get a notification. However, if 20 different people like that post I don't want 20 separate notifications when they finally check their phone. I want one notification that says '20 people have liked your post.' I also only want to track the new notifications. Say 20 people have liked your post. I don't want the notification for the next 5 who've liked your post to be '25 people have liked your post.' I want it to be '5 new people have liked your post.'
What I don't know how to do is delete a notification that got sent using Parse. An idea I thought of off the top of my head for recording new posts was to keep track of what the user has seen for that post but that seems silly. It's a large amount of data to keep track of, compared to querying for a previous notification to that user for that channel (is that possible?).
Anyways, I was hoping other users of Parse using push notifications might've faced this problem and how you all might've gotten around it. I would like to implement my own backend but I don't have the expertise and I'm currently focused on the client side. Any help or suggestion would be greatly appreciated. Thanks!

The thing is, you have don't have the control to cancel a Push Notification. However, you do have a control when to send even how to send it. If you want to implement something like you say, you have to do custom works on that. You might observe a period of time like 2-3 minutes whether there are more than for example 10 notifications you want to send. If so, send one instead.
Before iOS 8, Push Notification did have so many limitations like we can not have our own custom action. But now, I think Apple will let us do more as time goes by.

This might not be the best way but here's how I plan on implementing the feature. I'm going to add a notifications array to the user ([Notification objects]), this will also allow me to query for notifications for a possible notifications page. Say this were facebook and the user gets a new like notification on a post (1 like total).
I will create a new notification object and add it to the User object's notifications array with properties 'seen' set to false, 'prevNotificationLikes' set to 1, and then send out a notification. The message will be generic for singular/plural #'s of likes.
If someone else likes the post before the user responded to the push notification, I will see that the user hasn't 'seen' (false) the first notification and I will not send out a new notification.
Say 19 people like the post and then the user checks the initial notification and sets the 'seen' property to true. The next notification check on the cloud code for the 21st like will query to see if there are any previous notifications for that post/user. Parse cloud will then find a corresponding notification for that post/like where prevNotificationLikes is equal to 1 and update that number to 21. If the 'seen' property is set to true, then it'll send out a notification '20 new people have liked your post.' I know that the notifications are sent 1 step late with the fact that the user probably already knows that 19 people have liked the post but it'll be a compromise to get the job done.
Any critique is welcome. Sorry for wall of text instead of code. I'm just writing out my idea before writing the code so that I have something to follow along.

Related

user to user push notifications

I have seen many questions on here and online that address this topic, but they all are from a long time ago, and are possibly outdated. I wanted to get a more recent answer if Firebase has implemented anything recently that is capable of a user to user push notification system, essentially what is used in all chat applications, or if the best option is still currently using Onesignal.
Yes! These days, you can use Cloud Functions for Firebase to do things like send a notification when something interesting happens on the Database side of things.
Here's an example where a user gets notified via notifications when they gain a new follower. Obviously, your part of the database portion will probably change depending on what exactly you want to trigger a notification, but the general theory is the same.

Adding actions to UILocalNotification in iOS 10

I have an app that sends push notifications to the user.
I want to add to every notification 2 buttons (actions), I think it's called Rich Notifications.
I didn't find enough information on how to do it, so I would really appreciate if someone could guide me here.
Thanks!
You need to add a notification category and the category will have notification actions. Those actions will define what the buttons say and what gets passed to your app when the user chooses one.
Googling the keyword you provide return many results. Why don't you pick one and try it out for yourself. One of it can be found on this link
http://willowtreeapps.com/blog/wwdc-2016-rich-notifications-in-ios-10/

How can I send Parse push notifications to users after specific user action?

I have read a lot of tutorials and doc but I cannot quite wrap my head around it: I am trying to send users of my app a notification when somebody posts something new or if someone likes one of their posts (think Facebook-style table view displaying notifications as they happen). The certificates are set up and the app is able to receive remote notifications that I send through the Parse push console.
Obviously I want to send a notification as the actions happen, but I am unsure how to do that. Parse suggests using cloud code, but it seems to be in Javascript. Is there a way to do it in Swift? My first idea was to send the push from the users' devices as they interact (when the user likes a pic from you, he sends the push and you receive it) but apparently, it is discouraged as it is unsafe.
I understand my question is general, but I am lost as to how I can tackle this issue: can anybody give me an outline of how this should be dealt with? Not necessarily precise code, but a general idea of what I should do?

How do notifications work with Mailboxer gem?

I'm trying to figure out how to setup a notifications system using Mailboxer.
I've already used it to setup an in-site messaging system so that users can message each other. Now I'd like to use it to send notifications from the site, to notify users of changes in their reputation points or remind them of actions they must complete. Something like Facebook or Stackoverflow's dropdown notification menus.
As an example, it might contain these types of notices:
User gets some points for performing an action:
"You received 50 points for helping #{user.name} with #{request.title}.
A reminder that the user must perform an action:
"You must review #{user.name}'s help with #{request.title}!
Will link to a page to complete that action.
User receives a reply to a message they sent:
"You've received a message from #{sender.name}"
Will link to the message.
Here are some details:
I don't want all notifications to send an email. Most will only need to be seen in the notifications menu. Is there an option in Mailboxer to control what is emailed, or would I have to bypass Mailboxer's mailers?
I'll want to format each type of notification differently in the dropdown. Add a specific glyphicon to each for example. Could I use the notification type field for this (using it to set a conditional)? How does type work? Can I just set it to a string, such as "reputation", depending on the notification?
Objects can be passed to the notify method. I'm confused about the purpose of this. How can that object be used? What objects would I want to send?
Feel free to leave some general info on Mailboxer notifications rather than specifically answering everything.
I've had pretty bad luck finding documentation for the notifications features, so would appreciate it if someone with some Mailboxer knowledge could chime in on this. Thanks in advance.
This is an late answer but just in case someone came upon this question like me, this is what I ended up doing.
There is an user identities method defined as https://github.com/mailboxer/mailboxer#user-identities
If it returns an email, an email will be sent. If it returns nil, no email will be sent.
There is a notify method in mailboxer, and you can use it to send notifications as,
alice.notify("Hi","Bob has just viewed your profile!")
And in mailboxer_email, check if the object is a notification or not.If it is, do not send an email.
def mailboxer_email(object)
if object.class==Mailboxer::Notification
return nil
else
email
end
end
You can defined more complex logic here such as disable email for certain type of users, etc.

iBeacon notification database

I have a question which I have not been able to figure out so I decided to see if I can get some help on here.
I am working on an iBeacons project and I have been able to understand the basic function of iBeacons, setting up UUID'S and major and minor id's to specify exact notifications, but my question is how do I dynamically update information I send out to the users without having to go into the code each time to do this. Do I need to create a database to store all my information I want to push out to users? if so how will this database constantly refresh messages pushed out to users? An example would be lets say if you walk into a store and you get a notification in the shoe section saying there is a 10 percent off, you look at the notification but not too impressed and start to walk out, then you get another notification saying for today only you can get a 25 percent off... The app has to dynamically refresh for this to be possible.
Please help me clarify this
Thank you very much for the help
What you probably want is to store this deal information in a web service so you can update it without changing the app. Your app would need to download the updated deal information from the web service either when it starts up or when it sees an iBeacon.
My company, Radius Networks, offers a tool called Proximity Kit that makes this easy. You can assign arbitrary key/value pairs to iBeacons using a web interface. Then your app downloads them automatically an has access to them whenever you see iBeacons.
In your scenario, they key/values could be something like:
primary_offer_text=10% off all shoes
secondary_offer_text=20% off all shoes

Resources