How to Link a Databse to my Android App? - android

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!

Related

Retrieve firebase RTDB data into Recycleview in random

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?

how to make realtime chat app using firestore with recyclerview

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.

Reading and storing a set of data from Firebase Database?

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

How to retrieve data from Firebase to render lists in an app?

I am new to Android Studio. I connected Firebase to my app and am able to store data onto it along with the image. The data is like shown in the pic. I just want to know how can I retrieve all this data one by one in a list view or in such a view that it looks like items for sale. I don't know where to start coding.
I want output as a list where users can see items for sale :
Item Name - Laptop
Category - Electronics
Cost - 15000
Description - Good
Picture - ∆
..and then next item in list ..
How can I start on this?
Here a link there you can find how to make a recyclerview but in this code I used a firebase firestore so there you can use firebase instead to firebase firestore.

Can I rollback Firebase app(For Android) which I deleted unfortunately

I have deleted firebase app from console(For Android). My App is live now how can I rollback deleted app. or Any option.
There is no way to rollback/revert once the app is deleted from the list. It is deleted permanently from the list along with the Anayltics Data associated with it. As can bee seen in the warning:
But you can just add it back again, the same way you add a new app, through ADD APP (button also seen in the screenshot).

Categories

Resources