Example
- Complete the Installation and setup part. This will create the project in Firebase console and will also install the base SDK in your Android App.
- Add the dependency for Firebase Realtime Database to your app-level
build.gradle
file:
compile 'com.google.firebase:firebase-database:9.4.0'
- Now write a
Hello World
message to the database under the message
key.
// Write a message to the database
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("message");
myRef.setValue("Hello, World!");
- Check to see if the message showed up in the
Realtime Database
.