Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I hope you're well, I need some orientation since I'm new to using the Cloud Messaging service of the Firebase suite.
Here I have 2 applications, myapp_client and myapp_admin. What happens is the following, with myapp_admin I publish information that I insert in the Firestore database and with myapp_client I read this information inserted in the Firestore database.
What I want is that once the myapp_admin application publishes this information then it sends a notification to the users of the myapp_client application who can then open it.
I've done some research and I haven't found a good documentation (even the official one) that would explain how to send notifications programmatically from the dart/flutter code without using Cloud functions (This is possible)?
Can you please guide me? I'm not asking you to give me solutions but to guide me to find the solutions I need to implement such an operation.
THANKS
What you are describing will certainly require you to listen for new snapshots from a collection of notifications in Firestore in a background process of myapp_client, and then trigger a local notification when new data is received by using a plugin like flutter_local_notifications. Here is a helpful article explaining how code execution in the background can be done in Flutter.
If you want the myapp_client app to receive the data published by myapp_admin as push notifications even when your app is in the background without executing code in the background, the only viable and tested solution that works really well with Flutter AFAIK, is using Cloud functions.
The description by Nikolai using the local notification package together with client subscriptions is a fine solution.
Out of curiosity, why do you want to avoid cloud functions?
Using CF is a quite straightforward way to do it.
admin write information to firestore
cloud function triggers with the onWrite function on collection/doc that match where your admin wrote the data.
cloud function use FCM to send push notification to a topic that your clients subscribe to, or to individual devices.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am building a mobile app using Flutter. All user's data is stored online in a MySQL database, so the app needs an internet connection for almost every user interaction (there is a backend REST API).
Users have to be able to create some lists of tasks, update and delete every task and list, and so on. But from the user's perspective, the need for an internet connection for every simple operation like adding or deleting a task is a bad experience. I need a way to support these operations even without connection with the backend and to apply these changes later when it is possible. But what is the best practice to handle this case?
How to keep the app behaving like normal even without an internet connection and sync all changes that the user has done with the backend when the internet is available again?
For example, if the user creates a new list the app expects to receive the new list's object (with id) from the backend. Later this id is used for every backend call about this list like adding a task in it.
What you can do is use a state management approaches like
Providers, Bloc etc and have a local state of your database or the needed list inside them and apply all the changes on them when offline and implement all these on to the server when connected to internet.
Read here about flutter state Management
also you can check when the device is connected to internet with this connectivity and data_connection_checker packages
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
My situation is that I am building an app (in swift) that pulls data from an API & displays them in a tableview (say for example up to 500 cells). The problem occurs with the API. It is limited to 200 calls/day and 6k/month, and one request is equal to 100 pieces of data, so to display 500 cells it would cost 5 call credits.
I am stuck on how to efficiently use this API. Currently, each time the user refreshes the tableview it will cost 5 credits. Therefore after this has been done 40 times, the API cap has been reached for the day.
The only solution I have though of is to have some script in js/ruby/python that pulls the data every x minutes or x hours and saves this to Firebase databse or firebase Cloud storage and then in my app I can pull the data from Firebase?
My other idea was to run the script on a server and pull the data from there.
Is there any other simpler alternatives that I am missing?
To prevent over consuming why not you run the API and save the results to your own DB; create a custom API specific for your app to pull from your personal storage and this way you can control the interval and frequency of how often you pull on the premium API.
You can setup a job to auto update your personal DB with the premium data every x amount of time, update new entries and add new ones as you see fit while on the client side they will pull the same premium data you’ve pulled; imo that would be how I would go about because without control you’ll find yourself facing a major scaling issue.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm going to build realtime push notification feature for my web application ( a small social network) and I don't know where to start.
This is what I want to build: there are like buttons, comment forms, ... Users click like, write their comments and (relatively) immediately, on the owner's browser shows the number of new likes and comments, ... Something like that.
I've read about socketIo on nodeJs, MeteorJS but unfortunately, they need WebSocket supported by mordern browsers. I've just read about Comet technic and find it pretty easy to apply. But i'm not sure it will performs well because Comet relies on long-polling connection (correct me if I'm wrong).
In addition, I think facebook is using Comet for its push notification feature. Through console tab on firebug plugin I can see there's alway a holding connection to facebook.
So can anybody show me a technic, a model to develop a feature like that?
A promising idea is to work with the HTML5 notification API; it's perfect if you want notifications to pop on the user screen as long as his browser is running (even if you're surfing another website or if all windows are closed).
http://www.paulund.co.uk/html5-notifications
However, if what you want is to update different parts of your page asynchronously (without refreshing or pushing a button), you should use together :
Ajax calls;
Listeners and observers.
When you Ajax calls retrieve particular types of json data (for example), it can trigger appearance of a badge (listener) with a number of new notifications, or so...
With JQuery installed, you should be fine...
Even though it's often not the case, sometimes, for simple tweaks, it's easier to code the job done...
You can start here :
How implement a "observer" in Jquery without plugins? (it's old, but interesting)
Or see this page :
browser instant updates with ajax/jquery
(incredible how often google queries return stacko' pages)
You should check out MQTT. It basically works on the Publish-Subscribe model and is very easy to use. This protocol has a small footprint and consumes less bandwidth. Facebook's Messenger uses MQTT too.
you can use an ajax call coming into (for example) a php script on the server, which keeps the connection open and only replies if and when something needs to be displayed to the user. should nothing happen within a certain time, the connection gets closed and the client fires a new ajax call.
note that this only addresses the client/server communication, you would still need a notification method inside the server to wake up the php script if you want to avoid having a script constantly polling the database, but there are quite a lot of soultuions to this and they depend on what language you use on the server.
I have got an idea, it is simple but it may work. Why don't you hide notification bar as Div tag and design it with css to make it look like notification bar. Then whenever some user likes or comments about the page, write php or js function and connect it to like or comment submit button that will reveal page owners invisible div to visible. And I believe , depending on what you use, I would probably prefer php session() to Identify if page owner is online and can get notifications. moreover, if you need to track statistics of the page, you may create a small database that holds, page id and user comments. You can use this database to push multiple notifications on that hidden Div. you can use Jquery to make it move like Facebook if you want to. I m not %100 percent sure if this is the most optimized way to do that but it is possible. By the way, I surfed some to see what people use to do that. surprisingly I couldn't find something as well.
Is it possible to call an IBAction from a remote server? It would make my life easier. I have a quiz app for the iPhone, and there I have an IBAction/arc4random consisting of the quiz questions and answers. My little problem is that I'm only updating the app with more questions every time I submit a new version. The rest of the app stays exactly the same. If I somehow instead could update an .m file somewhere on a server, I wouldn't have to submit a new version every 1000 questions. Is that even possible?
Thankful for answers.
If you use a service like Parse.com you can build a database and just pull questions remotely similar to a web service. That's what we're doing in our Trivia app.
The short answer is NO. You can't change or call a code in your app from the remote server. You can however create a database with your questions/answer and pull database from your server by the app.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to implement a simple in-house table that tracks user page views on my website. Without targeting some specific hypothesis, what is useful data to store? Eventually I'll use it to build graphs or decision trees to better learn about our user base. This is static (no javascript).
Things I can think of:
URL accessed
HTTP refer[r]er
HTTP Accept Language
Browser-agent
Session id
User id (if logged in)
Time visited
It depends on how public your site is. If your site requires authentication you can have more controlled statistics because you can trace the user (visitors) history. In the case the user does not require authentication you are limited to the information provided by the SERVER VARIABLES: HTTP_USER_AGENT; REMOTE_USER; REMOTE_ADDR; REMOTE_HOST; REMOTE_PORT; HTTP_COOKIE; HTTP_USER_AGENT.
I have implemented something like this for some non-public site each time the user logs on to the site, the information I'm storing looks like:
User Key
Remote host IP
Date Logon
Last Request Datetime
Total time connected (minutes)
Last Request Minutes
Event/Action performed
Sounds like a good start,
I'd be inclined to store visitor IP address, and derived from that via a geo ip lookup the location of the visitor.
Also you could consider reverse dns'ing the IP to get an idea of the isp you're user is on, you might never use it but then again it could be useful if you have a report of downstream caching causing problems.