Saving Data on Android


Rules  tab, replace the rules with the above snippet and click  Publish



Download 19,28 Mb.
Pdf ko'rish
bet217/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   213   214   215   216   217   218   219   220   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Rules
 tab, replace the rules with the above snippet and click 
Publish
:
Saving Data on Android
Chapter 12: Introduction to Firebase Realtime Database
raywenderlich.com
209


Now, only authenticated users are allowed to read from and write to your database.
You can learn more about database rules in the documentation here: 
https://
firebase.google.com/docs/database/security/
.
Communica/on with the Real/me Database
You need a way to talk to the Realtime Database. The first thing you need is a 
connection. To get a connection you need to create a database reference first. Open 
RealtimeDatabaseManager
 class and add the 
databaseReference
 property:
private
 val databaseReference = 
FirebaseDatabase
.getInstance().reference
This gets you a reference to the root of the Firebase JSON tree. You'll learn more 
about data structure later in this chapter.
For connectivity testing purposes, add a method to the 
RealtimeDatabaseManager
 
that will write some dummy data to the database.
fun addDummyData() { 
    databaseReference.setValue(
"Saving data on Android"

}
Next, open 
HomeActivity
 class and add the 
realtimeDatabaseManager
 property:
private
 val realtimeDatabaseManager by 
lazy
 

RealtimeDatabaseManager
() }
Call 
realtimeDatabaseManager.addDummyData()
 from the 
initialize()
 method.
Saving Data on Android
Chapter 12: Introduction to Firebase Realtime Database
raywenderlich.com
210


Run the app and sign in with your Google account by clicking the 

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   213   214   215   216   217   218   219   220   ...   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