Currently I have a mobile application made with expo and react native and that shows daily weather data, in a graph it shows the data every hour (for example, average temperature). Weather data is taken from a database built on MongoDb. What I want now is that my application during the course of the day, when the temperature exceeds a higher value in the MongoDb database, a push notification is displayed in the mobile application (in production).
What I am thinking is to make an API (either in NodeJS or Python) that is constantly monitoring the database so that when a high value is reached, it sends an alert to the application and finally it can display the push notification. Now I have doubts because, how do I make my application keep listening in the background?
I have heard about firebase and apple push notification (since I am going to make the application on android and ios). Is there a way to not depend on these services?
I just want to know what path I can take and what tools I can use with to achieve what I propose. Monitor the MongoDb database, so that when a value is too high, it sends a push notification to the mobile application (in production).
Thank you all for your answers.
You can run jobs in Nodejs. It checks mongodb every 5 minutes etc. If you have any changes, you can sent push notification using the firebase api.
Related
I've been trying to learn Flutter by developing an Offline-first application using non-firebase backend API. The problem I am trying to solve derives from the following requirements:
Given User devise is Offline and he creates a record in the app, the record is stored on a local Database and is synced to backend once app is back online
If the app is not in the foreground, user should receive notifications once he is back online, given something changed on BE while he was offline.
Now, the problem is that reading through some packages that Flutter provides like background_fetch, I've stumbled upon the following limitation: "Background Fetch is a very simple plugin which will awaken an app in the background about every 15 minutes, providing a short period of background running-time."
The problem is that testing a similar IOS offline-first app I've noticed that notification comes through the moment internet is back online.
My question is the following: How can I achieve an immediate response/notification from my Flutter app once internet is back online, given that application is not working in the foreground. A fetch once every 15 minutes would work but is obviously is less than ideal, and given there are already apps on App Store/Play market that are notifying me immediately just keeps me awake at night. Is there a way to configure an event listener for connectivity change without relying on the 15 min limitation?
I have searched Google, YouTube and stack overflow for the answer but I haven't found any real solution.
I want to implement my own push notification solution on flutter, without firebase nor One signal. I do not want to depend on a third party service.
My Backend is on GoLang with graphql.
On the frontend, I am using a block pattern (flutter_bloc v6) and graphql_flutter v4.
I am using graphql subscriptions, so whenever the Backend emits a signal, the flutter app is able to receive it immediately.
I would like to be able to push up notifications to my users whenever the Backend sends some information, no matter if the app is on the foreground, background, closed or whatever. I do not want scheduled notifications either (aka flutter_local_notifications)
Do you want to use a third service other than firebase/one signal?
Then you can try airship(https://docs.airship.com/reference/messages/message-types/push-notifications/)
But if you want to setup your own provider server, please check this page(https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server), this is the start point, from where you can start your investigation and development.
Then you have to create your own backend system to send push notifications to the device. You have to develop Native Application for iOS and Android going beyond flutter. The local push notification could be used but you need to develop a custom notification receiver that will respond to the notification call back from the server in the background.
I want to create a game with Firebase, and I wanted to run a function when the current user gets a friend request in the real-time database. The function, for example, will show the friend request under a friend request table. Is there any way, perhaps in the App Delegate or elsewhere, where I can check for a friend request (an update in the Firebase Database) for certain intervals when the app is open (no matter which View Controller is shown)?
Thanks!
The Firebase Realtime Database client use a (Web) Socket to keep a connection with the servers. This is very efficient, but keeping the radio chip active uses significant power. For this reason the OS will typically close such connections when the application isn't actively being used.
To reliably deliver messages when the application isn't actively being used, consider using Firebase Cloud Messaging, which (on iOS) uses APNS for delivering the messages. This is a more power efficient way of delivering messages, so is typically allowed more leniently by the operating system.
I have an application that it makes requests to a webservice REST created using PHP. It's working perfectly my application makes requests and receive the data. But a want to know how can I make in my application to sincronize in real time with my server. It would be like an application messenger that receives the data automatically without an ask from user. How can I do it? Thanks
Your "real time" and "synchronization" are misleading terms. What you need is the implementation of Push mechanism. You can use cloud messaging from google, see this for details. Or checkout sockets and implement it from the low level yourself
To keep your app synced with your server, run a looping Timer on an interval in the background. Use it to check the server for new messages, and then feed those messages to the user.
Here a is an answer that may help you achieve this Android timer? How-to?.
I'm making an iphone app that uses NSURLConnection to download some data from the web. I need to store this data somewhere, so my app can send out push notifications when the data changes in a particular way. For example, the data being stored is a number and a push notification will be sent out when that number changes by +-10.
I'm new to this, so I'm probably overcomplicating how I think this can be accomplished. I'm thinking I need to create a database and some server-side code that continuously pulls the data. When the data changes to my specifications (ex. +-10), it somehow pushes the data to the app which then sends out a push notification.
Is there an easier way to accomplish staying within xcode dev?
The app doesn't send the push notification. The point of push notifications is your app can be in the background so it can't poll/check for a given condition (like your +-10).
When that interesting even happens server side, it can push a notification to the device. The device can handle that notification by (1) showing text (2) playing a sound or (3) updating a badge on an icon.
So, it's not about your device downloading the data into database (although that has value for offline and occasionally connected scenarios).
So, you'll need a server side component that detects that +-10 change (on data change or polling) and then sends the push to the device. Now, it's possible that devices are sending data to your service (uploading) and when and interesting event happens it could notify other instances of the app.
This link may help clarify push notifications: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12