Hello World!

Other topics

Hello World in Android

  1. 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.
  2. Add the dependency for Firebase Realtime Database to your app-level build.gradle file:
compile 'com.google.firebase:firebase-database:9.4.0'
  1. 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!");
  1. Check to see if the message showed up in the Realtime Database.

Hello World in IOS

  1. After you have set up Firebase to your IOS Project following the documentation for setting up firebase for IOS in other firebase related documentation you can get going with firebase.

  2. If you haven't already added the database pod to your Podfile do so now by adding pod Firebase/Database in order to get Database functionality for Firebase

  3. Push 'Hello World' to the database but first you have to go and edit the Rules for your database in the Dashboard of your app in firebase and change it to

     {
       "rules": {
         ".read": true,
         ".write": true
       }
     }
    

    NOTE: Make sure you change this beofre you go into production because this means anyone can read and write into your database which is a major security flaw

  1. Now all you have to do is import Firebase into the file you are using firbase in using import Firebase write the following line and you should see a 'Test' node in the database, expand it and it should have a child of "Hello World"!!!!!!
FIRDatabase.database().reference().child("Test").setValue("Hello World")

CONGRATS ON YOUR FIRST DATABASE PUSH

Contributors

Topic Id: 8885

Example Ids: 8859,21952

This site is not affiliated with any of the contributors.