This question already has answers here:
Delete firebase data older than 2 hours
(5 answers)
Closed 4 years ago.
I'm making a meeting app where user can create a group of people who are part of that meeting , also date and time of the meeting has to be set when group is created and store in the firebase database.
When the date and time of meeting is passed
Firebase should automatically delete child nodes of that group.
I'm thinking of cloud function , but don't know how to make this work.
On top of my head, you can do three things:
1) Cloud Functions: You correctly pointed it out that a cloud function is the correct way. However, a cloud function will need a trigger as far as I understand. You can run this trigger on a daily basis for instance to clear all meetings after due date. Potential way to run this trigger can be a cron job from a website like https://www.easycron.com/
2) Event Listener on a client: If you have a listener fixed on a client then you can put a check each time its run. So any client running their own event will clear it based on a check. It will not clear automatically after time passes but will clear once a relevant client listens for it.
3) Ignore meetings after due dates on a client. That way you save the old data as well. Might be costly in terms of bandwidth in the long term.
Also, if you have just started, I'd personally advice to use Firebase Firestore instead. I found it much better to use.
Related
This question already has answers here:
Can Firestore update multiple documents matching a condition, using one query?
(8 answers)
Closed 2 years ago.
I have created a chat app. In the app there is a collection named Chat and in it there are documents. Each document is a message that was sent and it contains fields such as Message, SentTime, IsButton.
Once something happens in the app (someone clicks a button), I had like to change in all of my documents at that chat the value of IsButton from False to True.
The data looks as follows:
Is there a way to change all of the Field values in one hit instead of using a loop?
I saw there is something called Batch however I'm not sure if it is limited to a maximum 500 updates.
Thank you
The two approaches you've found are pretty much the way to update a bunch of document.
You can:
either update each document individually, which is not nearly as slow as you may think.
or you can update the documents in one of more batches.
Having to update many documents with the same value may be a sign that you should reconsider your data structure. For example, maybe you can store the IsButton in a single, separate document that all clients then read/listen to.
I'm looking to add a feature to a mobile app that lets its users schedule events (including recurring ones). An example of an event could be Event A repeats every month on the 3rd of the month starting on March 3, 2011.
To be honest I don't know where to begin. After searching SO for a while I came across this answer to a question about representing and detecting recurring events in a relational DB. Briefly, the answer suggests creating two SQL tables (events & meta) where meta holds onto the repeat information for each record inside the events table. Using a join statement and a given date the provided SQL query will return those events that match the given date.
My question is, in relation to a mobile app, what are some meaningful approaches to implementing a scheduling system with support for recurring events? is the answer from the above link the right way to do this?
Use the following libraries: Background Fetch and/or Workmanager. Bear in mind those are easy searchable libraries. Mobile clients have limits over what you can and can't do in background and you can read about it using their officials docs.
iOS: Background Tasks
Android: Background Processing
I am looking to delete a node after a certain time, let's say that I want to place the node an expiration date of 5 days and in those 5 days delete the node. How can I do it?
My data structure is like this:
Posts:
PushedKey:value
How can I delete this pushedKey after certain time?
I recommend using Cloud Functions for Firebase. You can use an external service for cron jobs, using it to trigger an HTTP function at a certain time interval. Granted, this would be the same interval for all of the nodes instead of a timer counting down five days for each individual node. But, for example, you could trigger the function once a day and remove all nodes that were written to the database 5 days ago.
Here's a similar example applied to removing unused accounts
Here's the documentation on Cloud Functions
This question already has answers here:
How to delete firebase data after "n" days
(3 answers)
Closed 6 years ago.
I am creating an android app where I wish to add certain feature like Google Duo app. Using that feature where the user can specify the amount of time the message will be available on server.
I am using Firebase Real-time Database as backened. But as of now, I haven't succeeded in creating such a thing by using only Android client and Firebase which solves the purpose and is also valid solution.
Can somebody tell me whether Firebase provides such TTL(Time to live) functionality for data. If not then what will be the best way to create such feature?
Any help or info will be highly appreciated.
I think currently Firebase doesn't provide such functionality. But it will surely be quite interesting if they do.
Other than that I think that you can create something similar using a custom app server. Such that it stores the time stamp of those messages and listens for value changes. When the target time is reached, you can simply delete that data or (set the value to null). This should give you desired results if executed properly.
Firebase provides you great Server-sdk. You can use one for java (as it will be in sync with your app as well).
Background: I am working on an Android Honeycomb (v3.0) application that has a requirement of communicating with the Google Calendar API. I would like to allow my application to access a particular Google account's Calendar data in order to read and create events. I have figured out how to to this through the help of this tutorial and this thread that I have previously posted on stackoverflow.
My requirements: I would like to allow a user to add guests to the events. There are two types of guests: people and (meeting) rooms. I know how to add people as guests to an event, but I have no idea how to add rooms. The way room invitations are supposed to work are as follows:
1) Room is added to the event
2) The event is created
3) Room automatically responds to the invitation by either:
Accepting the invitation to the event and displaying it on the room's own calendar
Rejecting the invitation
The screenshot below displays how the Google Calendar in-browser UI handles this:
As you can see, I have added room 109 as a guest. If room 109 is available (which it is, because only available rooms are shown), it will accept the event invitation and add the event to its own calendar.
My problem: I have learned that I can check the free/busy times of a particular calendar by using the Google Calendar API as described here. However, I am not sure whether there is a special procedure for inviting the room to be a location for the event (see the "Where" textbox in the screenshot). Does anyone have some suggestions? Thank you very much for your help!
I have figured out the solution - a room can simply be invited by including its email address into the guest list. The room will then automatically respond to the request. I will have to check whether the room is available before sending it the request to warn the user that the room cannot be reserved if a reservation is already present for that time.