React Native notification/alert - react-native

In react native app
I want to implement a feature in which any employee whenever completes a certain task then reporting person should get notified
eg. Site visit, the employee checked in the app, etc.
So please guide me
How to implement this feature and which package should I use?
What I found till now
FCM
react-native-notifications
react-native-in-app-notification

As you are using a real-time database, write a listener which dispatches an event with some payload data every time an employee accomplishes a task.
In this context, any local notification package can push local a notification for each event dispatched.
I recommend https://notifee.app/ for Local notification, It has easy API and more notification-related features.
In case you favor cloud over local notification. You should review https://docs.wonderpush.com/docs/mobile-push-notifications-react-native. They have an easier-to-use API for pushing and receiving notifications.

Related

Notifications for inactive users

I’m implementing a solution that will notify users in a scenario very similar to a chat.
I’ll be using SignalR and Azure Notifications Hub for the job.
There are two scenarios that I need to address:
Notifying users that are currently connected and using my app - either web or mobile
Notifying users who are NOT currently using the app
I think SignalR will work just fine for the first scenario which is fairly easy.
My question is handling the second scenario which will require Azure Notifications Hub.
In a typical chat app, though it’s not real-time, there’s little delay before an inactive user receives a notification for a new message he receives.
How do I “trigger” a process that will send a notification through Azure Notifications Hub?
I can think of two ways to handle this:
Figure out a way to keep a list of users who currently have an active connection to my app. These users can be notified through SignalR. So after each new message, I could trigger a notification process that will use Azure Notifications Hub for users who are NOT in the active users list i.e. those who are NOT actively connected to my app.
Another approach would be to assume no one is connected. I could create an Azure Functions app that runs every minute to check on messages that are NOT opened. It would then compile a list of users who need to be notified and call Azure Notifications Hub process to notify them.
I don’t want to reinvent the wheel and want to tap into the experience of those who’ve already implemented a solution like this.
I’m currently leaning towards the second approach. I’d appreciate your suggestions, especially on approaches that I haven’t thought of. Thanks!

How to display all delivered notifications in react native? Firebase

I want to build a notification screen where it lists all the notifications associated with the current user.
I have successfully implemented Firebase to my react native app and Django rest framework backend and can send and receive notifications
But I’m having hard time figuring out how to display all the users notifications. Is that something I take care of in the backend or frontend?
You have to store all your notifications on the backend in your database, and then you just show them on the front.

What is the best way to validate monthly subscription in react native?

My react app uses react-native-iap module for in app purchases and It has a monthly subscription. I am facing few problems with validating my monthly subscription and I couldn't find any solution for that.
When user do a subscription first it will validate and update the state of my app as subscribed.
If user close the app and open it again also the validation will happen and update the state of the app as subscribed.
But user does not close the app, then there is no method to validate the subscription. User can use premium features until he/she close the app.
I tried with setInterval and periodically send request to the server to validate , but this method will reduce the performance of my android app drastically. So I can not use that method also.
Is there a correct/best way to validate monthly subscription periodically ? or Did I miss something by implementing monthly subscription ?
Thank you.

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.

How to send push notification according to dateTime which is stored in database?

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.