send notification to a particular user with notification hub - Azure and GCM - notifications

I am a software developer in Xamarin - Android, I want to create notification messages. For this purpose I use Azure notification hub, combined with Google's service - Google Cloud Messaging (GCM).
My problem comes when I want to send notification to a particular user. I realized that I need to use the "TAGS" When I compose a new user to the system (Uniqe TAG)
Indeed, it works great, but when the user logged off his account, and then connect to another one (with another TAGS) - the TAGS of his old account are kept in a certain time, and he continues to receive personal messages from the previous account!!!!
Does anyone know what can be done about it?
thank you very much

This is actually an issue a lot of people/apps have on iOS and Android.
What you should do is:
Register your app at your Azure Notification Hub (ANH) on first start and reregister at every app start, to keep registration in sync
If a user logs in, update the registration with an additional tag for this user (e.g. "user:XY")
Sending notifications to that user tag will of course result in notifications on all devices the user is logged in on
If a user logs out, update the registration without the user tag (omit the user tag, so the registration doesn't have user tag anymore afterwards)
The registration will be updated immediately on ANH and sending notifications to the user (tag) will not result in notifications on that specific client
If the user can logout on your app without internet connection, you won't be able to update the registration of course and you will still have the problem of getting notifications for a logged out user. But as soon as another user logs in, the registration should get updated with the new user tag and everything should be fine again...
What you shouldn't do:
"Developers should never unregister the client app as a mechanism for logout or for switching between users..."

Related

Chat Conversion Not Displayed in View - QuickBlox iOS Setup

Chat conversion not become visible after I changed my QuickBlox account. Before developer has setup chatting for my iOS application with his personal QuickBlox account so I require to switch it with my company QuickBlox account and later on I can do purchase of plans without any barrier.
After this change actual send messages didn't become visible on both side devices before this was working properly after my account change it get stopped in working. I was getting few errors on log related to this so please check:
Though multiple users get created in account so definitely connection with QuickBlox has been establish as per my thinking but message passing not working.
In chatting view, I have sent many messages but nothing appear on screen, remain as it is blank.
After spending 2 days with this problem, I found solution for this problem. Posting here as an answer so that other users will not consume more time for this problem.
At QuickBlox dashboard, you have to enable retrieve users list permission so that other user can get list of others information. By default this flag set to disable so you have to enable it. Here is screenshot for the same:

Strategy for notification checking

Is there a recommended strategy for checking of notifications within my AngularJS app?
By 'notification' I'm talking about message alerts that are to be displayed to a user when they're logged into the application.
My plan is to notify the user of unread notifications in the app's NavBar as shown below:
My app communicates with my restFul API (written using Node.js, express, MongoDB), so I anticipate that new notification will be written to a MongoDB collection with details the user the notification is intended for.
What I'm unsure about is how the AngularJS application will check for notifications once a user is logged on. I could call my API for unread notifications every time the user navigates from one path to another but that seems simplistic and it wouldn't work if a new notification occurs whilst a user is viewing a page.
Another way would be some sort of timer system that checked, say, every 30 seconds. But this would results in unnecessary polling of my API when there aren't any new notification for a user.
So, wondering if there is a recommended strategy. Thanks for your help.
Polling is a solution but it is very inefficient. The solution to your problem are websockets. Websockets is a technology that provides a full-duplex bidirectional communication between your clients and your server. So you can send messages from your server to your connected clients. Your server maintains an array of connected clients and you just have to know which ID you need to send a message to it.
For your stack, the best solution I have came to is Socket.io http://socket.io
It also have cool features. For example, you can "observe" models, so if a model change in your database, for example an update to a user profile is made, you can trigger an event and automagically send a message to your client. This client get and handles the notification and do something, like put a badge on your alerts icon.
Hope this is useful for you.

Onesignal: Web push notification for capture user votes

I am trying to implement a mechanism to push web notification to users and ask for their votes. I want to capture and store user's votes in my DB based on the feedback given.
For this purpose, I am using Onesignal's web push notification. I have managed to add a tag to each user to identify the user. So I can now send notifications to specific users. But when user clicks on the notification, I want to have the information about the notification like player-id, the actionid, notification id so that I can capture this information in my DB. I am not sure how I can get that.
Chrome and Firefox can support web push webhooks which may help, but I still don't have any solution for Safari. Can someone please suggest any alternatives or workarounds?
Thanks!

How to send invitation to facebook friend from my application

Hi I am working on Rails application. My application is currently in 'invitation only' mode. What I want to do is once user signed up to my application then user should be able to invite his Facebook friends to my application. So what is the best way to do it? I want to do similar like pinterest does. pinterest is also in invitation only mode. But still it allows my facebook friend to whom I have sent an invite to sign up directly. So how I can implement it in my application? Any guidance will be helpful..
Use the requests dialog:
http://developers.facebook.com/docs/reference/dialogs/requests/
Store the list of user id's you get back (which you need to do anyhow
to delete the request programmatically when the come to your app)
When a user tries to login to your app, ensure that they're on your
list of id's you stored earlier.
Delete their app request
See http://developers.facebook.com/docs/reference/dialogs
Deleting Requests When a user is directed to your application, by
clicking a Request from the application, the games dashboard, or from
a Request notification, you must delete the request after it has been
accepted. Requests are not automatically deleted once they have been
clicked, thus it is the developer’s responsibility to clear them once
they have been consumed.

iOS Push Notifications to specific user in the same deviceToken

I am using Urban Airship to test push notification and it went well.
My problem is how do I specify which user to get the notification not just the device token.
I mean in some situations where one device has multiple users, so many users registered the same device token to server.
Or do I have to do the filter on the device (client side) itself?
There's no real way to do what you want unfortunately. In APNS there's only such thing as a device. You push a device and it shows a message / badge / sound on that device.
If your app can have multiple users associated with it then you'd need to work out from the push which user it relates to and handle it accordingly. How you do that would depend on your app but you could add in a custom key to the push which indicated the user it's for.
If your app only ever has one user logged in at once then I suggest that when you hand the push token to your server, the server first turns off push for the user that the token was originally registered for and subsequently turns push on for the new user.