How to send push notification according to dateTime which is stored in database? - asp.net-mvc-4

I need conceptual help.
I've a web application in asp.net MVC that create schedule (just like reminder application) according to date time and store this information in database. Now I would like to send message to user on that date and time(not manually.
Users means mobile phone app (My created app) user, phone will receive push. user not concerned about my web application it a control panel.
Usually i send push notification manually to user device by running a script from web application, It can send instant notification but i need to send it according to time schedule automatically.
How can i do this???

You need a task scheduling library for web application. define a task and run task in background for sending notification in desired intervals. For more info read this post by Scot Hanselman.
Here is top 20 NuGet packages for tasks.

Related

Asp.Net Boilerplate Notifications

I have Notifications working in a .NET Core web application using the Abp Boilerplate framework. I've also implemented EmailRealTimeNotifier so that after the Push notification is sent, an Email is sent as well.
I'd like to give Users of the application the ability to choose as a preference, whether they want to receive
Push Notifications Only
Email Notifications Only
Both Push and Email Notifications
I figure I can refactor the EmailRealTimeNotifier class used to send Emails with some clever logic hopefully. But I'm stuck on where and or how I would implement code to prevent the Push Notification from firing off.
You can save the settings in the Settings per user provided by abp, read those settings and based on that send the emails or push notifications.

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.

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

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..."

Xamarin Forms and PushSharp

I am developing a Xamarin Forms project which targets iOS and Android. Because I want to have push notifications, I came across PushSharp. In this video (around 25 - 30 min): https://www.youtube.com/watch?v=m2txoLvosVw, the developer have a iOS project and a PushSharpServer project where he sends a notification to a certain deviceToken.
In my project I have the application which talks to a database with Google App Engine. If a user registers a new post in my application and it gets registered in the database, what will be the best way to send out notifications to some users that a new post is available? Should the database send back a list of all the devicetokens that will get the notifications and then the notifications will be sent from the PushSharpServer-project in my application? Im a little confused about how this workflow should be so I was hoping someone could throw a little light on this subject :)
You can develop a PushSharp server app of whatever it is; console,windows service,desktop application..etc
There are many ways on how you want the app to send notifications,one of the basic ways is as follows:
Once a new post inserted, add a new record into a notification
table in your database
PushSharp server app must periodically
check notification table for any new records,then fetch device
tokens from your database then start sending notifications using
PushSharp library
Delete the record from notification table

IOS : Push notification on user defined time duration

My app should get push notification on user defined time duration (like on each Monday 11 AM).
So for that App have to check for new updates on server (on background) on user defined date and time, App might not be running at this time, but it still has to check for new updates on server. If any update found, server will send push notification for the same.
How can I implement time based background process?
Thanks!
Why don't let the server do all that? I mean, you will have to do a post with the selected date by the user from the app, and the server at the selected time will send a push notification to that particular user (you know what user it is by his token id). Amazon Web Services works like that for example.