Create User Profile Using Cloud firestore 2020 || firestore user profile

 

User profile firebase 


Here I will show you how you  can make User profile app using firebase firestore .for this we will use firebase firestore for saving user data .

Use our flexible ,scalable NoSQL cloud database to store and sunc data for client and server side development.

cloud firestore is a flexible scalable database for mobile web and server development from firebase and google cloud platform.Like firebase realtime database it keeps your data in symc across client apps through realtime Listener and offers offline support for mobile and web so you can build responsive apps that work regardless of network latency or Internet connectivity .cloud firestore also offers seamless integration witth other firebase and Google cloud platform products cloud functions.

How does it work ?


cloud firestore is cloud hosted NoSQL database that your iOS  ,Android and web apps can access directly via native SDK .cloud firestore is also availabke in Node.js,java,Python,Unity,C++ .

Following cloud firestore NoSQL Data model ,you store data in documents that contain fields mapping to values These documents are stored in collections,which are containers for your documents that you can use to organize your data and build queries .Document support many different data types,from simple string and number,to complex nested objects.You can also create SubCollections within documents and build hierarchical data structures that scale as your database grows.The cloud firestore data model supports whatever data structure works best .

Here in this blog I will show how you can create an android app for creating user profile using firebase cloud firestore .

Expressive querying 


In Cloud Firestore you can use queries to retrieve individual ,specific documents or to retrieve all the documents in a collection that match your query parameters.your queries can include multiple chained filters and combine 
filtering and sorting.They are also indexed by default so query performance is proportional to the size of your result set,not your data set.

Realtime Updates

Like realtime database ,Cloud firestore uses data synchronization to update data on any connected device .however ,its also designed to make simple ,one time fetch queries efficiently.

Offline support 

It supports offline data retrieval.





So guys first of all we will create a project and then we will connect it with firebase and then we will implement it native SDK for using it so here in this tutorial we will create user profile using cloud firestore for this we will obviously use firestore.

first of all we will create activity_main.xml for UI where we will use imageView and edittext for getting data from user and this we will be our first activity Create user activity.After this we will code in mainactivity for uploading that data in firestore .

Where we will we declare an Integer variable for image and other for edittext and also for ImageUri.
So first of all we will choose image and load it in ImageView using Picasso library it is a open source library for uploading and downloading images. After this we will upload that data in firestore Using map because it is the way for uploading data in firestore .First of all we will upload image in storage then after this when it will be uploaded in firebase storage so we will get it download Uri and then we will create map where we will save its value in firestore database .

Now our Image is uploaded successfully and we we have its download Uri so after this we will create a map and then we will save the image Uri with other data.

Now profile Created Successfully- 

So guys after this we will retrieve that data for showing it to user for this we will create another activity for showing that data Show Profile .Here we will use same childs for showing data and we will use get method for retrieving data . 

Profile Retrieved Successfully-

So guys its time for Updating data for this we will create another activity update user. Here in this activity we will use transaction for updating data .

Now Update Profile-

So guys for updating user profile we will create another activity Update User and there we will retrieve all that data and then we will Use Transaction for updating that data .

Thing to remember-

  1. You have changed firestore rules.
  2. You have given Internet permission.
  3. Version of dependencies should be updated.
  4. You have given reference properly.

Source code below-










so guys I hope you liked my tutorials and it helped you in learning android development :)

Post a Comment

0 Comments