How do I Enable Offline Support? | Get to know Cloud Firestore #9

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 112

  • @immortaleternal5125
    @immortaleternal5125 5 років тому +127

    Really had me there with the buffering, almost contacted my ISP.

  • @leeboyin945
    @leeboyin945 4 роки тому +26

    01:11 What it means when you go into offline mode?
    01:45 Read data
    04:30 Write data
    *Questions*
    07:00 How large of a cache do we actually keep to store all that offline data?
    08:33 Why are you seeing a lot of duplicate data calls?
    09:55 What's up with the web, why isn't offline mode enabled by default?
    *Gotcha*
    11:13 With document writes, the callback to a document doesn't get called until the write has actually been confirmed on the server.
    12:14 Transactions will fail when you're offline.
    12:42 On the cache right now, there are no indexes.

  • @AleXoTroN
    @AleXoTroN 5 років тому +116

    The buffering part was nice😂💪🏼

  • @codinginflow
    @codinginflow 3 роки тому +15

    Success listeners for write operations not getting called while offline is indeed tricky. I'm glad I heard that here because I had some places where it broke my offline functionality.

  • @kirill4531
    @kirill4531 5 років тому +23

    The best "documentation" on a library ever :)

  • @bennyswayofficial
    @bennyswayofficial 3 роки тому +2

    Most people who searched for this video about billing, your answer is here: 13:15. Yesm we are devs, we think like this, and yes we would provide a bad user experience for the app to bill us less :)

  • @JakeCrawfordOfficial
    @JakeCrawfordOfficial 5 років тому +38

    Best intro ever in a tutorial video 😂

  • @wesleybarnes5376
    @wesleybarnes5376 4 роки тому +3

    This is so cool. I don't have to go and setup a local db, try and sync it with a server (so much work) ,and this works by default! Turned on flight mode and the magic happens.. and I did not even know about this feature.. Respect!

  • @brialcorp8448
    @brialcorp8448 4 роки тому +1

    Not just the buffering part was nice, but the overall video is helpful. When the video was buffering(for real) for the second time, you got me there also.

  • @ARITRAMUKHERJEEjan1989
    @ARITRAMUKHERJEEjan1989 5 років тому +4

    The buffering part was lit btw great content as usual

  • @kenargo
    @kenargo 3 роки тому +3

    The one thing about offline support is that it's much harder to debug (especially security rules). I've reverted to adding await() call so that errors are seen as exceptions otherwise I haven't found a way to see runtime errors in the debugger, they just silently fail

  • @mariolopes6262
    @mariolopes6262 5 років тому +2

    incredible. there is no miracle, but this offline technology is close to heaven.

  • @KelvinWKiger
    @KelvinWKiger 5 років тому +9

    To avoid the "last write win" from the conflict resolution, you talked about security rules and cloud function.. I guess "transaction" can also do the work right ?
    I look forward your blog post on that.

    • @amrojjeh
      @amrojjeh Рік тому +1

      Transactions would just fail since data has to be up to date

  • @Nikon1101
    @Nikon1101 5 років тому +1

    Thanks a lot for a great playlist of lessons! Real pleasure to watch, listen and study

  • @HaizadAnnuar
    @HaizadAnnuar 2 роки тому +1

    My question would be can Firestore detect which data should be applied first after the offline data gets sync if the device's clock is incorrect when the offline data was stored on the device?

  • @PeterBernardin
    @PeterBernardin 3 роки тому +2

    This is absolutely hilarious... I wish all tutorials were like this

  • @theincompletecircle
    @theincompletecircle 5 років тому +1

    For get we have an option to fetch only from server. Why is it not possible to do the same for real-time onSnapshot listener? There are a couple of places where query is extremely slow for me because of caching and speed is way more important for me in those cases. Please add this option because I get a lot of complains regarding speed and it's not possible for me to disable caching because offline writes are very important for my app.

  • @ericharrison4583
    @ericharrison4583 3 роки тому +3

    You are really good at your job.

  • @trieunguyen336
    @trieunguyen336 5 років тому +1

    Really thank you!!! I wish there would be many mini-projects as examples for what you presented in Kotlin. As a beginner of Firestore, all 9 videos are too much information for me. I did try Friendly Eat Codelab, but got stucked at displaying data from Firestore.

  • @amankataria4609
    @amankataria4609 5 років тому +1

    I have a complex transaction with my database when it's offline, so I am using SQFLITE package, and I plan to use Firebase as an online database. If I create a sync method between these databases when there is internet connection, is it alright?

  • @KelvinWKiger
    @KelvinWKiger 5 років тому +3

    Does a query against the cached data cost money?

  • @codinginflow
    @codinginflow 5 років тому +10

    I love the humor 😂

  • @tomasfilip984
    @tomasfilip984 5 років тому +1

    Waiting for unity offline support. Intended to be supported?

  • @saim6616
    @saim6616 4 роки тому

    We have a Chat app (Android) developed based on firebase (Real time database) cloud. Currently chat history was coming only when we are in online, when we don't have internet it was showing blank. For getting the chat history in offline did we have develop any additional code in android app or simply we have to enable the offline mode option.

  • @xyaless
    @xyaless 5 років тому +1

    Is it a viable strategy to use Caching to reduce the amount of Reads?
    Im trying reduce the amount of reads by enforcing document reads from the cache instead of listening to valueChanges/get requests to the Server.
    So what im trying to do is, - i have a fieldValue that is called 'lastEdit': 'Server Timestamp' (Server Timestamp for consistency) in all my Documents.
    I first query all my *cache* documents that im about to read from the server, and get the latest Server Timestamp(cache) and give that value as a variable to the function that checks if there are any documents that have a higher lastEdit than the one in the cache, if yes then i get them, which should automatically update my query to the newest documents and only read the minimum of necessary documents.
    Im not really sure if this is viable so i would like to hear some opinions.
    (I suppose it is already automated (a feature of firestore - to only get what is needed) but its not working quite well on my side? For example: I have a collection with 10 Docs, i go to the side where the docs are loaded for the first time => 10 reads, i add a new doc => 1 read, because of subscription, now i to the same site but (a different window?) settings and then back to the now 11 Docs => 11 reads, (Im kind of expecting that it would only charge me for reads when i read them for the first time or there are some changes and not for everytime i visit the page... (too costy to host when it reaches the amount of 800 documents (default amount)))

  • @mojikashani2545
    @mojikashani2545 4 роки тому +3

    Love the guy!💕 google please make interesting tutorials for us. That's true we have to watch these videos, but shouldn't have we fun!?😉

  • @bitwisedevs469
    @bitwisedevs469 5 років тому +1

    Pending writes work only on delete() in my android app, calling set() doesnt do anything when I get back online. Can someone explain to me what should I do.

  • @caseywest7369
    @caseywest7369 2 роки тому +1

    Is this offline supported for Flutter Desktop apps? Specifically Windows?

    • @axelpehl
      @axelpehl Рік тому

      This is exactly the Information i Need as well. Anyone got the answer to this?

    • @caseywest7369
      @caseywest7369 Рік тому

      For me it the answer was to not use Firebase haha. Used Supabase with SQLite for the local instance. Been working flawlessly, it is just Postgres and not a document based db. @@axelpehl

  • @jibin2706
    @jibin2706 2 роки тому

    The entire series is so informative & funny :)

  • @amankataria4609
    @amankataria4609 5 років тому +2

    One more question, in my Firebase database, I have a document of my customers who have purchased items from me. And in the document's fields, I have various maps of different items. Now all these maps have "price" as one of the fields (field in maps), If I want to total of price all items(which are in form of a map in 1 document, is it possible?
    If no, what's the alternative?
    NOTE:1) Kindly assume I can't save these items as separate documents
    2) The map has many fields

    • @abdurrosyidh
      @abdurrosyidh 5 років тому

      Aman Kataria store the total price in 1 separate property..

  • @iancuvlad7368
    @iancuvlad7368 4 роки тому

    Does Cloud Storage have a similar offline persistence mechanism, or it's just available for Cloud Firestore?

  • @mavinis
    @mavinis 2 роки тому

    So I'm developing an app with Flutter and Firebase, and I created a repository to manage local and remote data, and I'm using SharedPreferences to store data locally, and I created Streams to deliver local and remote data to the UI, and everytime I get some data from firestore I am saving it with SharedPreferences. And then I find this video. Are you telling me that firestore already does all of that automatically?

  • @vrajendramandloi5917
    @vrajendramandloi5917 4 роки тому

    hi, can you plz explain caching and how can that reduce my read cost ?? i have my website which is hosted on firebase , but a lot of users are viewing my website not buying much, for that i need caching at server of all docs and providing users a specific list of Docs only. Thanks great job ..

  • @kamaleshbasu3755
    @kamaleshbasu3755 4 роки тому +1

    Great video. Does Realtime Database provide similar "auto caching" and "fetch only on change" features? Or is it only possible with FireStore?

    • @ezscootrr
      @ezscootrr 4 роки тому

      Same question. My app is new and I'm thinking if I should switch to Firestore

  • @factual01495
    @factual01495 4 роки тому +1

    Really had me on the buffering part
    👍👍

  •  4 роки тому

    I'm not expecting an answer, but will ask the question anyway in the hope I will. I'm making an app where I want data to be available online and offline. That means I will have to have database on the device as well. And if the user goes online, then data gets updated on the firestore server automatically and across connected devices. But this will include files such as images, possibly videos and strings. So do I need to create ROOM database and somehow synchronise it with firestore? Or there is a way I can Implement this with firestore? Thanks.

  • @MuhammadAdil7
    @MuhammadAdil7 4 роки тому

    First of all I loved that buffering part honestly, and I thought it is my network :D Well I have a question, I have a document name "SeasonOne" and it has further sub documents "Episodes1,2,3....70" So each Episode has a title and Url. Well I have written a simple query and my persistent database is enabled. So whenever I will run the application is it going to make server call every time? I have internet enabled all the time. One more thing I want to clear that is I just fetch "SeasonOne" and it gives me list of sub-documents(episodes). Is it going to be counted 70+1 reads every time I open application? I have a terrible situation at the moment and I really wants the answer.

  • @AzMahgs
    @AzMahgs 3 роки тому

    I just needed content. But you gave me quality and entertainment

  • @SyedKumailHaiderNaqvi
    @SyedKumailHaiderNaqvi 4 роки тому

    If the data online is the same as offline cached data, and we perform read operations, do we still cost for the reads?

  • @kristianczepluch6147
    @kristianczepluch6147 5 років тому

    Does this unlimited cache when writing also apply to the firebase realtime database?

  • @pradeepc8838
    @pradeepc8838 2 роки тому

    Hey, how to cache a stream of videos from firestore and then retrieve them, so that the videos don't buffer in flutter. For an app like tiktok.

  • @8Kexperience
    @8Kexperience 4 роки тому

    what about firebase cloud-storage offline support? My quick Google searches does not say anything about it.

    • @8Kexperience
      @8Kexperience 4 роки тому

      @UCZ0SEPZzWkA2rSlxMfTUI_w awesome thank you!!!

  • @xixixiaojie
    @xixixiaojie 2 роки тому

    Great video! Please does this also work for images? Writing an image to the Firestore while offline, displays the "cached" image then uploads to the Firestore when there's connection. Is this possible?

    • @Frank_van_Puffelen
      @Frank_van_Puffelen 2 роки тому

      *firebaser here* That's definitely possible, and would already work for images that you store in Firestore. I wouldn't recommend storing images there though as they'd count against your global cache size there, and honestly there are better places to store images. For example, storing the images in Cloud Storage will be much cheaper, and it also comes with a Firebase SDK. If you store the images there they won't be cached on devices by default, but there are great caching libraries for all platforms too. Also check out this video where Todd and Susan explain offline behavior and strategies for all Firebase products: ua-cam.com/video/XrltP8bOHT0/v-deo.html

  • @lucasaraujo6.
    @lucasaraujo6. 2 роки тому

    Is it possible upload data and read it while offline? I mean before conect to internet.

  • @DebmallyaBhattacharya
    @DebmallyaBhattacharya 5 років тому +5

    Love these videos. However, they're too fewer in quantity. Also, anybody tell you that you look like Robin Williams?

  • @vishalgaurav4411
    @vishalgaurav4411 4 роки тому

    If I am fetching the same document again and again and it has not changed, will it cost me a one read everytime? Or will it use the local cache. I am on Android

  • @kanundash
    @kanundash 3 роки тому

    I love that loading buffer joke!

  • @vhoyer
    @vhoyer 4 роки тому

    how do I disable offline mode on web? If I put one of those toggles for the user to choose if he/she wants or not to enable persistence, if this toggle is set to false, how do I turn the percistence off? is there a `disablePercistence()`?

  • @croydon21H
    @croydon21H Рік тому

    How can I try this? Is there an example? lets say my code is
    let query = store.collection("products");
    const querySnapshot = await query.get();
    How can I use cache or reduce number of reads ?

  • @DenisTRUFFAUT
    @DenisTRUFFAUT 5 років тому

    Excellent video, with very interesting use cases !

  • @martinalcala4823
    @martinalcala4823 4 роки тому

    Reads from the cache data are billied?

  • @andresmontoya7852
    @andresmontoya7852 5 років тому

    Thanks! Does it support react native with expo?

  • @YoussefARRASSEN
    @YoussefARRASSEN 3 роки тому

    5:27: it generally takes a few thousand writes,
    are you challenging me?

  • @moayadkom
    @moayadkom 5 років тому

    Could you please make how to connect firebase with swiftui 5.1?

  • @leonardosibela
    @leonardosibela 5 років тому

    At 5:45, ... says that the data is synced when the user gets back online. That's not neccesarily true. In my recent tests, the app needs to be open and, apparently, the there must be an socket open or something. Anyone has an exactly answer to this?

  • @yonit.chauhan
    @yonit.chauhan 4 роки тому

    How long are offline write requests saved in cache? 6:33 what if user is offline for several days (>7) and performs a write on day 1, will it still be uploaded on the 7th day(when the user is back online)

  • @jinwooseong2862
    @jinwooseong2862 4 роки тому

    Thanks for Korean subtitle.

  • @truongsa405
    @truongsa405 3 роки тому

    Cannot use import statement outside a module
    import firebase from "firebase/compat/app";
    import "firebase/compat/auth";

  • @macgera
    @macgera 3 роки тому +2

    your documentation is not full. This video explain nothing. :/

  • @mingzhu8093
    @mingzhu8093 2 роки тому

    Is there a way to lock a document? Say it marked completed the not more update can be done on it.

    • @Frank_van_Puffelen
      @Frank_van_Puffelen 2 роки тому

      Nothing is built in for that, but you can roll your own by adding a field to each document that says that it's finalized locked and then reject any further writes in security rules.

  • @karannagpal2442
    @karannagpal2442 5 років тому

    Very well explained. Thank you!

  • @wandiledlamini1214
    @wandiledlamini1214 3 роки тому

    LOL nice intro, I thought I lost connectivity there for a sec

  • @KelvinWKiger
    @KelvinWKiger 5 років тому +6

    Haha.. Love the intro!

  • @kevinwakhisi7001
    @kevinwakhisi7001 4 роки тому

    Just liked the intro damn so creative

  • @ngabarra
    @ngabarra 5 років тому

    Does the same logic apply to the Realtime Database?

  • @codinginflow
    @codinginflow 5 років тому

    Reminder that there is a Firestore tutorial on my channel:
    ua-cam.com/play/PLrnPJCHvNZuDrSqu-dKdDi3Q6nM-VUyxD.html

  • @MarkRonnelCamilon
    @MarkRonnelCamilon 5 років тому

    how to implement offline support for flutter?

  • @leventkantaroglu7892
    @leventkantaroglu7892 5 років тому

    Thanks for explanation of this issue

  • @icode7334
    @icode7334 3 роки тому +1

    Great Video

  • @prasadjadhav3906
    @prasadjadhav3906 2 роки тому

    You know it's gonna be a fun video when they break the 4th wall

  • @kewaldangal8750
    @kewaldangal8750 3 роки тому

    Not link online payment system

  • @seccat
    @seccat 2 роки тому

    "I'm sorry he needs to go on the plane with me. 💻 He is a licensed emotional support server" 🤣🤣😆

  • @shakirkasmani
    @shakirkasmani 4 роки тому

    How to enable it for flutter?

    • @wesleybarnes5376
      @wesleybarnes5376 4 роки тому

      Works on my flutter app by default. I have listview builders that bring up 100's of records from cache without having to do anything. Pretty cool!

    • @wesleybarnes5376
      @wesleybarnes5376 4 роки тому

      Note, these were done with FutureBuilder returning a ListView.builder

  • @driziiD
    @driziiD 2 роки тому

    him: "if you put your server in offline mode you have bigger problems"
    me: cries in network partitions and CAP theorem

  • @oiojin831
    @oiojin831 5 років тому

    Finally!!!

  • @samuelpeterson9534
    @samuelpeterson9534 4 роки тому

    Genius!

  • @zervidasmc
    @zervidasmc 3 роки тому

    There is Indonesian

  • @aminchigara2854
    @aminchigara2854 5 років тому

    You got me good

  • @devashishbahri3353
    @devashishbahri3353 4 роки тому

    "if you are putting your server on airplane mode, you might have bigger problems" 😂😂

  • @heshansandeepa9471
    @heshansandeepa9471 5 місяців тому

    awesome

  • @creative-commons-videos
    @creative-commons-videos 5 років тому +1

    the only worst thing of firebase is Vendor Lock :)

  • @sonalithakker6517
    @sonalithakker6517 3 роки тому

    The buffering 😂😂😂

  • @KrullMaestaren
    @KrullMaestaren 3 роки тому

    Watched this at a location with poor Wifi, totally fooled me xD

  • @lucienmendela7390
    @lucienmendela7390 5 років тому +3

    Imagine the life of a developer without firebase.

  • @BooleanDev
    @BooleanDev 3 роки тому

    wow, the video lagged at the same time the rest of youtube wouldnt load

  • @Suraj12123
    @Suraj12123 2 роки тому

    😁

  • @matiasolguin6705
    @matiasolguin6705 3 роки тому

  • @mjonausk
    @mjonausk 5 років тому

    lolz

  • @rajaramanv
    @rajaramanv Рік тому

    The cartoon animation figures are not amusing ! They are only distraction in a technical presentation like this.

    • @swap-codes
      @swap-codes 8 місяців тому

      bhai tu thora dekisugi he kya?

  • @lordswaggity1213
    @lordswaggity1213 5 років тому +2

    Simple answer: You don't! 😝😝😝