Push Notification with Urbanairship - ios

Im developing an iOS app that has a feature of Push notifications. Its a sports app where a user can add players to their favorites list. Each player has 3 kinds of events.
Like,
score a Goal
got a red car from referee
got a yellow car from referee
Now in this scenario,
User X has configured player A for all 3 types
User Y has configured player A for first 2 types
User Z has configured player B for last 2 types
Now Server receives an update for Player A scores a Goal(1st type).
What exactly should be the payload?
I have tried the following
{"aps": {"badge": "+1", "alert": "Player A scored a Goal 10K", "participantID":["A"],"tags":["score a Goal"]}, "aliases": ["sportEvent2013"]}
At present im broadcasting the update, that is every device configured with APNS receive the push and only the one which matches the tag and participantID is displayed.
It does work, but i think this is not appropriate like every device receive the updates which can be in thousands, (im not using device token) because i can not tell who has configured for which events?
Please help me with the right approach.
Thanks

I can give more details if you give more details about your setup (all client, server component, etc). However the general idea should be to use the 'Tags' feature by urban airship (you can use alias too.. but that's not as flexible):
UAirship Tags
The general concept is to 'subscribe' a user and their device token to a tag such as "PlayerAGoalScored". And then when that update comes through you can just tell urban airship to send a push to everyone subscribed to the tag 'PlayerAGoalscored"

You could set it up so that when a user configures a player to receive a particular type of notification, the app updates your database. Then, when the server receives an update for a player, query your database for those who have that flag set and send the notification only to them.

Related

Beginner Firebase User FCM Set-Up Questions

FOR iOS
Notifications
Cannot see an option for in app pop up messsages - is it only push/re-engagement message types?
Can the notifcations be automated not just scheduled one by one? Can this be done programatically? I.e. Something left in basket so send automatic push
Can the notifications be triggered based on in app user behaviour not just audience or property and can they have a time lag e.g. 3 days after trigger? I.e. User clicked on X promotion and hasn't returned in 2 days
Active Users 1, 7, 30 day
Accuracy of data - how reliable is the Firebase Active user data - what is the definition of actives reported?
Viewing new vs returning? Is this possible? I cannot find a view of this in the dashboard?
User Properties
When you add the code for the setUserProperty() once is is registered how does Firebase start to gather than data on this user property value?
Cannot see an option for in app pop up messsages - is it only
push/re-engagement message types?
FCM is for Notifications and data messages. At this time, if you want messages to appear in the app, you would use a data payload and handle the appearance of a pop-up within your code. See About FCM Messages for details on Notifications vs data messages.
Can the notifcations be automated not just scheduled one by one? Can
this be done programatically? I.e. Something left in basket so send
automatic push
From the console, you can schedule notifications. If you want to automate based on events, I suggest you use a combination of Cloud Functions for Firebase and the Admin SDK. Store the FCM tokens in the database for sending.
Can the notifications be triggered based on in app user behaviour not
just audience or property and can they have a time lag e.g. 3 days
after trigger? I.e. User clicked on X promotion and hasn't returned in
2 days
As for a delay, that would be something you'd have to handle in your own server.
Accuracy of data - how reliable is the Firebase Active user data -
what is the definition of actives reported?
According to the documentation, "An active user has engaged with an app in the device foreground, and has logged a user_engagement event."
Viewing new vs returning? Is this possible? I cannot find a view of
this in the dashboard?
No, this is not possible. You can see the first_open event and extrapolate from that.
When you add the code for the setUserProperty() once is is registered
how does Firebase start to gather than data on this user property
value?
According to the documentation, "User properties are effectively sticky event parameters that are automatically logged when you call logEvent."

Swift Clear specific remote notifications

We are currently developing an IOS application. The app should basically inform the staff member about new events/requests and the staff member has the option to cancel or accept the event (e.g. customer asks: "I d like to have a coffee", the staff member says: "okay, I'll do it" or "sorry, can't do it"). The idea is that the request appears on multiple smartphones (from multiple staff members) at the same time and that the notification has the buttons for accept/reject included.
The thing is we would like to solve this using Notifications (remote). But there is one thing which is not clear to us. Lets says I receive three requests/notifications. But until I have time to check them, on of the other staff members already resolved one of those requests. Is it possible, that this given requests can be cleared/removed from all staff members phones? Because otherwise I am handling a request that has already been resolved?
And what would be the best option to solve it.
Push remote notifications for every request
Push silent notification for every request and then clear out all notifications on the client, get the new/current requests using REST (GET) and add a local notification for every request?
Thanks a lot for your help.
Regards
I think second option is good.
you can refresh the data using REST api after receiving silent push.
I'm thinking best option is use Push silent notification because end user (Application Holder) will not get clue of that and it is best for us.
I would recommend 1st option
Send remote notification for every request
Handle duplicate request from backend
I think 2nd option is not reliable
APNs treats silent notifications as low priority and may throttle their delivery altogether if the total number becomes excessive. The actual limits are dynamic and can change based on conditions, but try not to send more than a few notifications per hour - source
And Individual notification can't be removed - Check this:

Notifications with SignalR2 and MVC

I want to build a menu notification with SignalR 2 in my MVC app.
So, when some user do a specific action, some others users (not all and not the same every time) must be notified. Some like the SO notification when somebody answer a question.
Do I should store the connectionId in a database to know who must be notified after the action is triggered? What would you do?
I had to do something similar and this is what I did:
1) Define notification types based on user roles. Each notification type had a list of specific recipients. That way I knew if a notification type was created I had to notify certain users.
2) I send the notifications by name, not by connection id.
3) Notifications can be sent from client code (JS) or from back-end code (C#). In JS you have functions like "others" that are really handy. In C# you have "others" too but that only works with connection ids.
4) I'm notifying changes in the data too so if someone is changing order 1, I notify a supervisor and any other user that has the order opened (in this case I send the notification to the supervisor and all the other agents and based on the order each user has opened I decide if I handle the msg or not).
I hope this helps!

Sending events between participants on an active twilio video call

We are experimenting with the Twilio video call SDK for iOS and we are able to establish a call between two users but now we would like to send events from one user to another. For example, one user would tap a button on his device and the event would be sent to the other device to display a sound or animation. Basically we are looking for a way to establish a data channel between both callers that we can use to send events, much like a websocket.
Thanks for your input! Regards,
Enrique
Twilio recently announced a State Syncronisation API which you can use to solve your problem , have a look : https://www.twilio.com/sync
For your case, you could setup up a "Map" item ( a map of event to device identity ) on Twilio sync which could be used by a device to push their events to Cloud to which any subscribed devices can get the info pushed to .

Distance based push notification from specific point in ios

i want to send push notification to users who are at a specific distance from a particular point .
if suppose my location is fixed. let us say distance is 3 miles, i want to send notifications to users who are in 3 miles radius from my location.
now i am able to send push notifications from server side,if my requirement is possible in iOS , guide me with better tutorials,
out of all my device tokens how to know that particular device tokens separately…..
Note:
the notifications should only delivered to particular users who are at a certain distance from my location not to all users.
thank you ...
Parse.com has sample code for doing this, but you need to make the required information available yourself as it isn't built in.
Basically, you need to know what location each of the devices is at (or where each user is and what device they are using) and run a filter yourself to get the list of devices that you want to push to. Then push only to those devices.
There are 2 possible ways I'd solve the problem.
First is to make your app submit the user's position in every x minutes. This is the easier but less efficient way.
The second, more efficient way is to send a push for all the devices with no message, badge and sound (so a silent push, the user won't know about it) with a custom payload that contains the coordinates of the point you want. Then on the client side, process this message, get the current location of the device and show a local notification if your current position is near to the one you got in the payload.
I would do the following:
Backend Service(Server)
Knows which device shall be aware of which location.
Delivers the coordinates of the locations to the devices.
Frontend(app)
uses region monitoring.
receive the coordinates and accuracy from server.
one region is one coordinate from the server with accuracy.
fire loval notification if the uses cross the region border.
its only one possible way... you can also trigger the location of
all devices and regions at server side and send remote notifications
to specific devices. a very good example on APNS you will find at
raywenderlich -> http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

Resources