A check before saving to the Cloud Parse - android

I want to do a check on the cloud first before I save the data. For example...
Do a query to check if a Task name and User situated to it is there.
If there is update it.
If not save to the cloud.
I'm having the issue with checking with two params like you could with SQLite on Android.
Any Ideas?
Thank you

Just call whereEqualTo multiple times to add more constraints to the query.

Related

How to keep firebase realtime database in sync with firebase storage, the standard approch to this problem of two nested queries?

How to keep firebase realtime database in sync with firebase storage? I am trying to store images in firebase storage.
The current scenario
a POJO (which contain 3 images placeholder link) is saved in the realtime database.
Then the 3 images are uploaded in firebase storage and on successful upload the respected placeholder links in the realtime database are updated.
Now the problem is that sometimes when the user deletes the project in between the POJO is deleted from firebase but the links are still updated.
Is there a better way of doing this ? or is there any standard approch? Thankyou for your time.
There is not a standard approach to this, and it can't be solved by simple configuration. You will have to get creative and implement something that meets your specific needs.
One thing you can do is use Cloud Functions triggers to mirror and delete data between the two products, so that one data in one is added, modified, or deleted, that change is reflected in the other product. It would take at least two triggers, one database trigger, and one storage trigger, to make sure changes in either product are mirrored to the other product. You might also need some additional process to remove or correct invalid data periodically, if that is a concern.

Determining if Firebase didn't download data with startAt and endAT

I'm trying to download data with Firebase. The issue is that I'm downloading the data based off of a timestamp. If their is only one item in my ListView that I'm populating, I want to get the next two hours worth of data from Firebase and if there isn't any data from the last two hours, I want to get the next two hours of data and so on until I get some additional data. The issue is that I don't exactly know how to determine if Firebase actually downloaded data. Because if data was downloaded, I can use an OnScrollListener for my listView to download more data since it will be scrollable after that point. Any help would be appreciated.
You cannot know when getting the data from the database is completed becase Firebase is a real-time database and getting data might never complete. That's why is named a realtime database because in any momemnt the database can be changed, items can be added or deleted.
The only way to partially know if you have all the data at a particular location is to perform a single 'value' type query on it. Even then, the data may change after that listener is invoked, so all you really have is a snapshot at a particular moment in time.
You can use a CompletionListener only when you write or update data in your database and you'll be notified when the operation has been acknowledged by the Firebase servers but you cannot use this interface when reading data.

Why the data from firebase database deleting automatically?

I'm using Firebase Real-time database for one of my application. I used to store some key data in the database. but the database deleting the data automatically. why?
there are possible reasons of "why" data was deleted, please check them:
Security rules in the firebase DB may be set to allow to anyone write (and delete) the data. So the data may be deleted mistakenly by some user.
If need to append the data - using of setValue() instead of .push().setValue() - will override rather then append
In case it was not helpful - please provide more details.

How to get the last data entry with greenDao?

I am using greenDao to manage my database and I need to get the last entry that was made. How do I do this? Is there a way to query the last ID entered or to somehow save it for later use?
this works for me:
daoSession.getMyDao().queryBuilder().limit(1).orderDesc(MyDao.Properties.Id).list()

In Parse, can I force related ParseObjects to get fetched?

In the Parse android docs it says that by default, related ParsePbjects are not fetched, implying that there is a setting that will fetch them. It later says that they cannot be fetched without a call to fetchIfNeeded. Which is it? I definitely need to fetch the related ParseObject and would prefer to do so without having to make multiple requests. Is that possible?
By default, when fetching an object, related ParseObjects are not fetched. These objects' values cannot be retrieved until they have been fetched like so:
In the ParseQuery you are using to get the original object, you can use the include(key) method to tell it to also fetch the related object. This works for pointers and arrays of pointers.
No They Can't. I am also facing the similar problem. SO if you have two table and one table is having reference key from second table, then there is no such query where we can find relative data.
Its Sad. I wonder why they don't provide such a useful thing.

Categories

Resources