Firebase - uploading images when internet is offline

后端 未结 2 1936
耶瑟儿~
耶瑟儿~ 2021-01-31 19:30

Firebase has great option of using their database and sending data to their db even if you are offline, and then when the connection is up again, it sends automatically the data

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 19:56

    Technically, the accepted answer is incorrect given the OP question, which is,

    send images even if the internet is off

    The accepted answer talks about resuming a download once started, which correct in detail but does not address the answer correctly.

    The corrected answer is "no", you cannot upload an image to Firebase Firestore if the device is not connected to the internet, the upload will fail and there is no auto-restart of the upload operation.

    As previously noted, you must be connected to the internet, at lease long enough to start the upload and get an uploadsessionuri URI from Firebase. Once the upload has started then you can resume the upload using this sample code or the code above.

    As noted in the documentation, the resume URI is valid for about 7 days but it is the developer's responsibility to ensure that the file contents has not changed since the start of the upload.

提交回复
热议问题