This question already has an answer here:
Does firebase log metadata such as 'created_at' automatically
(1 answer)
Closed 4 years ago.
My Android application is connected to Firebase, and I retrieve data from database successfully. But my question is there is any way to get what time the data stored in ddatabase to retrieve it to my application?
I hope my question is clear.
is there is any way to get what time the data stored in ddatabase
No, Firebase realtime database does not store metadata. You should create your own mechanism by storing the desired time as a timestamp in the database as explained here.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
If I log events offline and then send them online in a bulk to Firebase then, will the event date be the same as the date of sending or logging?
Neither Cloud Firestore nor Firebase Realtime Database does not have the date and time stored in the metadata. If you need this feature, you should add a timestamp property for each document/node separately. That actually represents a FieldValue.serverTimestamp() in case of Cloud Firestore and a ServerValue.TIMESTAMP in case of Firebase Realtime Database.
Please also bear in mind that both types of timestamps are generated on the server. In the case of Cloud Firestore it's a Date object, and in case of Firebase Realtime Database is a long value which represents the time since the Unix epoch, in milliseconds.
If you have this kind of property present in your database and you set/modify it once an object is added/changed, then the date and time of that property is the date and time when the device comes back online since the timestamp is generated entirely by Firebase servers. And to answer your question:
will the event date be the same as the date of sending or logging?
It will be the time of sending and not logging.
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 4 years ago.
Improve this question
I have an app (field data collection) where I used the sign in option and authentication with firebase.
All the other database the default option is to store data as a local SQLite database, however, I want to add the option if the user wants to sign in and transfer the local database to an online database so it can be accessed on multiple devices.
Can I have together firebase and sqlite?
I mean can the user store the data offline and when goes online with a sync button can have the data online in the firebase cloud?
My sqlite database stores data from drop down columns, google maps longtitude and latitude data, voice recordings and images.
I would appreciate your help, and hope you understand my questions!
Yours sincerely,
Tzirineto
Yes, this can be possible. The data in SQLite is stored in the form of tables i.e rows and columns i.e. its a relational database. But the data in the firebase id store in the form of documents i.e. key-value pair. Your first step is to create objects in Java. Then it will be easy for you to dump same objects in both SQLite and in firebase. Also you have to maintain a proper relations among the data using uid in firebase. When the user clicks sync button you have to add the objects in the firebase. In order to do that first you have to retrieve the complete data from SQLite and store it into java objects then send them to firebase. You have to keep a check among relationship that exists among the data. Hope it helps
This question already has answers here:
Prepopulated database - Android application
(4 answers)
Closed 5 years ago.
I have done a lot of research about the SQLite database, and have already created a SQLite custom helper that extended SQLiteOpenHelper. However, I don't understand where to actually create the database and fill it out. I am trying to have the database be created immediately; I have all the information that needs to be inserted. In other words, no user input is required to fill it out.
Is the best practice to create an individual java class or activity that fills out the database, that can then be accessed by the activities?
Thanks - did a lot of research on creating the database and helper, just having trouble understanding this.
I am trying to have the database be created immediately; I have all the information that needs to be inserted.
Create the SQLite database on your development machine. Package it in assets/ and use SQLiteAssetHelper to ship it with your app. Then, you can query from that data (e.g., to display it to the user).
This question already has answers here:
How to retrieve and display images from a database in a JSP page?
(6 answers)
Closed 7 years ago.
What method should I use to retrieve and display my image which is store in mysql with the datatype longblob. As for string I simply use
(Example: rs.getString("foodname"))
but waht is the datatype to use for the image as I declare it as object in java class. So should i use ?
rs.getObject("image")
Thank you
Basically you need to get it as blob and convert this binary data to image see this example
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 have to store 500-1000 values in somewhere, but i cant decide which one is more efficient(ArrayList vs Database).Can you explain pros and cons of arraylist and database?
thanks...
In memory data structures are always faster than DB.
But tradeoff is between size of data structure and available memory. For your need, arraylist will be faster. But data will be gone once application is stopped or killed.
Database is persistent data store. If your need is to store temp data then arraylist is suitable and if you need to store it permanently then you have 2 options:
Database (standard way, API availalbe, standard practice)
Filesystem (keep your data in data structure till application stops and then write it to a file in encrypted form if security is required.)
If you need, explore about in memory databases for android(sqlite). This is best suitable for you.
the use of array list and the data base is different.
if u doesn't want to store your record permanently then you can use "Array List", but if u want to store your record permanently then u need to use data base.
because when you store the record in Array list those record stored into RAM. records don't store into the secondary storage. but when you store the record in to the data base then records stores into the database.
if your concern about the speed of accessing the data from Array List or data base then arrayList is faster then the database