How can such scenario be implemented in a social app Android java. I have built my app with Firebase RTDB and I am retrieving the data into a Recycleview using collection.shufflelist too so that I get random data displayed.
How to add another condition to collection.shufflelist(); that will make the latest post show at the top in that same random order but post that are created within the last 24 hours should be randomly placed at the top.
I have tried to use the logic of
reference.child().orderChildBy(timestap).startAt(system.currentTime....).StopAt(1356890000...) but I only saved date into my database in Simple date format, YY-MM-DD.
So I cannot add another node to save timestamps because app already has installs in several users phone changing database structure or adding new nodes/child may affect the app.
My question now on this situation how possible is it to set my random retrieved data to have the latest at the top?
Related
this app uses to store vendors and users and chat between them. I want to make an android chat app using recycleview and firebase firestore but the problem is that recycle view doesn't update properly so how to do that. data also get but after sending time not show instantly message I want to go back after that show message and also message not show proper order from firestore so how to do it.
message history also wants perfectly. please help to solve this problem this is my code.
This is the structure of the firebase firestore database
I want a simple solution to how to make a real-time chat app with firestore and recyclerview...
Look bro -
If u want to get real-time update using firestore then add
Snapshotlister then u get real time update..
2nd things that
If you want to make chat app .then
Don't go with fireStore because ur read and write count ll become increased
Due to this Ur Firebase bill will be high.may be u can't afford it.
And also it is not recommend to use firestrore to making chat app.
I am building an android app that uses both Room and Firestore.
The app will have a long list of items that are stored in Firestore. When the user first launches the app the app will read all the items from the Firestore and store them in Room and from then on the users app will read the item list from Room.
Now, this item list will change but only about once a month so I need a system where I can update the list in Firestore and then send a message to all users that the items list has changed. They must then do a one time fetch to get the updated items list from Firestore and write it to Room.
Using Firestore listener is not an option as this will result in hundreds of unnecessary reads every time a user opens the item list activity.
Also Firebase Cloud Messaging only seems to be recieved by users whos apps are online.
Is there a way to notify all users apps (even those that are offline) that the data set has changed and that they must execute a fetch and retrieve the updated item list?
Is there a way to force users to check for new messages from Firebase Cloud Messaging whenever the app starts so they can get the updated item list?
Instead of using FCM to serve this information, I would integrate a "list" version number into a document that is accessed whenever you start up the app.
For example, it's common to have a service status document (such as /global/status) that contains important meta information such as latest application versions for your mobile apps (to show "Please update" messages), information about upcoming outages or links/IDs to blog posts that you use to serve news/messages to your users.
If you have a suitable document, you would add an entry for "listVersion" that could be a timestamp, a version number or the like. If using a version number, you have the added benefit of being able to use semantic versioning and give it special meaning. Update immediately for major changes, prompt the user to update their database (if on mobile data) for minor changes and maybe update only over WiFi in the background if it's only a patch (such as fixing a typo somewhere). To mix the version number with a timestamp, just use the year and month as the major and minor versions and keep the patch number as is (e.g. v2019.11.28). The meaning of each version is up to you as how you are updating the list and it's purpose is not known.
I have set of data stored in Firebase Realtime Database (snapshot attached).
Click to View
I want to read this data when I press a button in my Android app and store it according to the person name, for example storing that Jack is 20 years old and Marry is an engineer, but I need to do this for more than just 3 users.
I'm able to call the data and read it but storing it in the way I described above is not working.
EDIT:
I added part of the code I'm working with, my main goal is when I click a button to call the data from Database, I'm able to do this but I can't figure out the best way to store this data in a way that I can use it. For example I want to display the name of the user and his role and age but I want to do this for as many users as available in database.
Code here
I'm developping a store app and i encounter a problem regarding the real time refresh .
Let me explain it better , This app is a clothes store and everytime my friend adds a new collection i have to update the app.
But the thing is that every image of the products (let's say , jeans, t shirt, etc..) are stored in drawable folder of the app , and at last the aplication itself grow huge .
This issue cause several problem , the first one is that every image are stored Inside drawable folder , the second one is that everytime my friend adds a new collection i have to updade the application (and add the new collecion to drawable folder) .
I know this ain't the best way to store data so i would like to set up a database with SQL , so my friend could add it's collection throught it and my app will grab it in realtime so i do not need to store data inside the app and i don't need to update it every week
I would like to know if it is possible and if so, how am i supposed to do ?
Let's say my friend has 3 new Jeans to add in it's collection, i create a RecyclerView w/ Cardview to Display the original Jeans Collection, Now how am i supposed to do to make it grabbing from the Database and adding to the RecycleView the 3 new Jean of the collection?
Thanks
PS :I'm sorry for my english
Instead of setting up your own server, you can use Firebase Database to store your data.
Basically, you will need to store the description of each item as well as its image (so that you won't have to update your app every time an image is added / modified).
For storing the images you can use Firebase Cloud Storage.
The documentation is really great, it should be able to guide you from here.
Use Firebase. Connect your app to the Realtime Database.
Get the SHA-1 fingerprint of your app by running signingReport from the Gradle Projects pane in AS
Go to the Firebase console and create a new project
Click "Link to your Android app"
This is in the top of the page, with the Android logo in a circle.
Type in the package of your app and paste the SHA-1.
Click next
Go back to Android Studio and go to Menu Bar>tools>Firebase
In the pane that shows up, expand the "Realtime Database" thingy
Click the button under the Realtime Database item
Click "Add Realtime Database to your app"
MAKE SURE YOU ARE SIGNED IN WITH THE ACCOUNT THAT HAS THE FIREBASE PROJECT IN ANDROID STUDIO
Click "Set up dependencies" now you're good to go with Firebase Realtime Database!
I am making an app for my college where we have to parse RSS feed and display it. I am using SAX Parser to parse it and its working smoothly. Now I want two functionality in my app. First of all I want to run it as a service so that it may notify users about new events i.e new updates from RSS and how should I differentiate between the old RSS feed parsed and the new one so that I can show only the new updates.
Please give a overview on how can I implement these two things.
I don't know about the first question (how to make it a service) but I've done the second in a past life. The way I went about it was:
Compute the hash (sha1) from the title (you might want add other fields too)
Store the hash into a database along with time stamp
If the hash matches the entry in the database don't add it
if (3) fails add to database
Display everything in the database in descending order of timestamp (latest first)