How to check if a User Data exists in Database or not | Firebase Firestore A complete tutorial || PART 5 ||

Hey, what’s up guys, this is a simple small tutorial to check if the user already stored the data in the database or not the database of the user is empty.

Here is the video tutorial for your help

You can check this in your any activity you just need to add this one simple line of code.

                        .addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
                            public void onComplete(@NonNull Task<DocumentSnapshot> task) {
                                if (task.isSuccessful()) {
                                    if (task.getResult().exists()) {
                                        Toast.makeText(MainActivity.this, "You already have your data Stored in database",
                                    } else {
                                        startActivity(new Intent(MainActivity.this, StoreUserData.class));
                                } else {
                                    Toast.makeText(MainActivity.this, "Error: " + task.getException().getMessage(),

So in this code we check that in the collection “Users” we have the current user id named document saved or not so if it returns false then the data is not stored so in the oncomplete we check if the task is existed then we show a toast otherwise we send the user to any activity or you can do anything you want…

Its simple to check that.

In the next part, we will fetch those user data to our application and create a profile like a thing.

Source code Available in GitHub- 

You can get all the series Post using this link-> Click Here

Posts created 41

32 thoughts on “How to check if a User Data exists in Database or not | Firebase Firestore A complete tutorial || PART 5 ||

  1. Good site you’ve got here.. It’s hard to find good quality writing like yours nowadays.
    I truly appreciate individuals like you! Take care!!

  2. I was very pleased to uncover this great site.
    I need to to thank you for ones time for this particularly
    fantastic read!! I definitely enjoyed every bit of it and I
    have you bookmarked to look at new information in your

  3. certainly like your web-site however you have to check the spelling on quite
    a few of your posts. Several of them are rife with spelling problems and I to find it very bothersome to tell the reality nevertheless I will certainly come
    back again.

  4. Hi there! I know this is somewhat off-topic however I had to ask.
    Does operating a well-established website like yours take a large amount of work?

    I am completely new to operating a blog but I do
    write in my diary everyday. I’d like to start a blog so I
    can share my own experience and views online. Please let me know if you have any kind of suggestions or tips for new aspiring bloggers.
    Appreciate it!

  5. Hey there! This is my first comment here so I just wanted
    to give a quick shout out and tell you I truly enjoy reading through your blog posts.
    Can you recommend any other blogs/websites/forums that
    go over the same topics? Thanks for your time!

  6. That is really fascinating, You’re an excessively professional blogger.

    I have joined your rss feed and look forward
    to seeking extra of your excellent post. Additionally, I have shared your site in my social

  7. Have you ever considered creating an e-book or guest authoring on other websites?
    I have a blog based on the same subjects you
    discuss and would love to have you share some stories/information. I know my visitors would value your
    work. If you are even remotely interested, feel free to shoot me an e mail.

  8. Hi there, I discovered your web site via Google even as searching for a comparable topic, your site came up, it looks good.

    I’ve bookmarked it in my google bookmarks.
    Hi there, simply was alert to your blog via Google, and located that it’s truly informative.
    I’m going to watch out for brussels. I’ll appreciate should
    you proceed this in future. Numerous other folks shall be benefited
    from your writing. Cheers!

  9. I am not certain the place you are getting your info, however good topic.
    I needs to spend a while learning more or working out
    more. Thank you for great info I was looking for this
    information for my mission.

  10. I think that is one of the so much important info
    for me. And i am satisfied studying your article. However wanna statement on some
    normal things, The website style is wonderful, the articles is in point of fact excellent
    : D. Just right process, cheers

  11. It is perfect time to make some plans for the future and it’s time to be happy.
    I have learn this publish and if I could I desire to recommend you few fascinating issues or advice.
    Perhaps you could write next articles regarding this article.
    I want to read more things about it!

  12. I really appreciate your work, really give delight to us as loyal readers
    of your website blog. Will let you me to share this blog site on my Fb page and my followers Poker Online Qiu Qiu online terpercaya 2020 also
    really like the outcomes of your writing. Retain the quality of
    your work and good work. 🙂

  13. Thanks for a marvelous posting! I seriously enjoyed reading
    it, you’re a great author. I will be sure to bookmark your blog and will eventually come back at some point.
    I want to encourage you continue your great posts, have a nice

  14. Hiya very nice blog!! Guy .. Beautiful .. Superb .. I’ll bookmark
    your website and take the feeds also? I’m satisfied to find numerous helpful info right here in the post, we’d
    like develop extra techniques on this regard, thank you for sharing.
    . . . . .

  15. It is in reality a great and helpful piece of information. I am satisfied that you just
    shared this useful information with us. Please keep us informed like this.

    Thank you for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top