Saving Data on Android



Download 19,28 Mb.
Pdf ko'rish
bet275/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   271   272   273   274   275   276   277   278   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Working offline
Like Realtime Database, Firestore can also work 
offline
. Cloud Firestore stores a 
copy of data that your app is using, locally, so that you can have access to the data if 
the device goes offline. You can perform operations like reading, writing and 
querying on the local copy. When your device goes back online, Firestore 
automatically syncs the data with the data that is stored remotely!
Firestores offline persistence is enabled by default for mobile clients. You can test 
this in your 
WhatsUp
 app.
Build and run your app. Add some posts if you don't have already. You can add some 
comment to that post as well if you like. Now disconnect the device from the 
network and kill the process of your app. Start your app again and you'll notice that 
your data is still displayed on the screen.
Now add another post. Tap on the floating action button on the home screen and 
enter some content for the post and tap the 
Post
 button. Nothing happens because 
you only consider post saved when it is saved to the remote database.
Go back to the home screen by tapping the system back button. You'll see your post 
that you added while offline is displayed on the home screen. This is because it was 
saved to the local cache. If you open the console and look into the database you 
won't see that post in the database.
Now connect your device back to the network. You'll get a toast message on the 
device that the post is saved an now you can see your post in the remote database.
If you don't want to have the offline feature enabled, you can disable it when 
initializing Cloud Firestore.
Check the official 
documentation
 to learn more about offline support.
Other features
Cloud Firestore has many other features. You'll go through some of them next.
Saving Data on Android
Chapter 18: Reading Data from Cloud Firestore
raywenderlich.com
271



Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   271   272   273   274   275   276   277   278   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish