Saving Data on Android


Other offline scenarios and network



Download 19,28 Mb.
Pdf ko'rish
bet236/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   232   233   234   235   236   237   238   239   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Other offline scenarios and network 
connec/vity features
Firebase has many features that can help you when offline mode and connectivity 
are an important part of your app. The features you're about to learn apply to your 
app regardless if the local offline persistence is enabled, or not, in your app.
Saving Data on Android
Chapter 14: Realtime Database Offline Capabilities
raywenderlich.com
235


Real-/me presence system
The 
real-time presence
 system allows your app to know the status of your users — 
are they 
online

offline

away
, or some other status. This feature is inevitable for 
chat applications for example, because you want to know if the person you are 
texting is online. This feature may seem simple, but to build an entire app 
infrastructure or a mechanism, which handles this for you, can be quite troublesome.
Firebase has this infrastructure implemented and it allows you to use it out of the 
box. Firebase saves the user presence status info to the 
/.info/
connected
 location that you can observe just like any other location in the database. 
The 
.info/connected
 reference just contains a 
boolean
 which indicates if the 
client is connected or not. The problem appears if you want to write something to 
the database when the user status changes to the offline status. For this case, you 
can use the special 
onDisconnect()
 method which Firebase provides, that tells the 
Firebase server to do something when it notices that the client isn't online anymore. 
The 
onDisconnect()
 method works properly, even in cases when the app crashes, or 
the connection is lost, or any other nasty edge case.
On Android, Firebase automatically manages connection state to 

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   232   233   234   235   236   237   238   239   ...   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