First create a database:
Code (Java):
FireDatabase database
=
new FireDatabase
(
"./accountkey.json"
)
;
Now you can save data to the database by parsing a hashmap with the keys and value, a collection and a document.
Code (Java):
HashMap
<
String, String
> favoriteSong
=
new HashMap
<>
(
)
;
favoriteSong.
put
(
"Imagine Dragons",
"Believer"
)
;
favoriteSong.
put
(
"ABBA",
"Don't stop me now!"
)
;
database.
setField
(favoriteSong,
"Music",
"Favorit artists and songs"
)
;
You can get Data by using:
Code (Java):
database.
getString
(
"Music",
"Favorit artists and songs",
"ABBA"
)
;
or
Code (Java):
database.
getBoolean
(
"Music",
"Favorit artists and songs",
"has favorite song"
)
;