+4

Introduction of Firebase

Firebase.png

What is Firebase

Firebase is a cloud services provider and backend as a service company. Firebase can power your app's backend, including data storage, user authentication, static hosting, and more. Firebase provides these services so you can focus on creating extraordinary user experiences.

Features

**Firebase Realtime Database: ** Data in your Firebase database is stored as JSON and synchronized in realtime to every connected client. When you build cross-platform apps with Android, iOS and JavaScript SDKs of Firebase, all of your clients share one Firebase database and automatically receive updates with the newest data. It has 03 Most Wanted advantages are-

1) Automatically scales with your app

2) First-class security features

3) Works offline

**Firebase Authentication: ** You can easily authenticate users from the Android, iOS, and JavaScript SDKs in just a few lines of code. Firebase has built-in functionality for authenticating users with email & password, Facebook, Twitter, GitHub, Google, and anonymous auth. Apps that use Firebase's built-in auth services can handle user login entirely with client-side code, saving you time and the headache of operating your own backend. You can also integrate authentication with your existing backend servers using their custom auth tokens.

**Firebase Hosting: ** Deploy your web app in seconds with Firebase's production-grade static asset hosting. All of your content is delivered over SSL from the global CDN. Every app gets its own firebaseapp.com domain, and paid apps can deploy to a custom domain.

firebase_third_party.png

Firebase Open Data Sets

1) Airport Delays: Get the latest airport delay and status updates in realtime.

**2) Cryptocurrencies: ** Get the latest USD/BTC and USD/LTC exchange rates in realtime.

**3) Earthquakes: ** Information on earthquakes anywhere on Earth in realtime.

4) Parking: Realtime data on the latest street parking price and garage availability for SF.

**5) Transit: ** Up-to-the-minute location data on public transit vehicles from 50+ cities and college campuses across North America.

**6) Weather: ** Realtime weather data from 31 cities across the United States.

offline.gif

Firebase has announced mobile offline support

** Sample of Android **

** Writing Data: **

   myFirebaseRef.child("message").setValue("Do you have data? You'll love Firebase.");

**Reading Data: **

   myFirebaseRef.child("message").addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot snapshot) {
          System.out.println(snapshot.getValue());
        }
       @Override public void onCancelled(FirebaseError error) {
   }});

Tutorial: https://www.firebase.com/docs/android/

Demo:

  1. AndroidChat: https://github.com/firebase/AndroidChat

  2. SF Vehicles: https://github.com/firebase/geofire-java/tree/master/examples/SFVehicles

** Sample of iOS **

** Writing Data: **

   // Create a reference to a Firebase database URL
   Firebase *myRootRef = [[Firebase alloc] initWithUrl:@"https://<YOUR-FIREBASE- APP>.firebaseio.com"];
   // Write data to Firebase
   [myRootRef setValue:@"Do you have data? You'll love Firebase."];

**Reading Data: **

   // Read data and react to changes
   [myRootRef observeEventType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {
       NSLog(@"%@ -> %@", snapshot.key, snapshot.value);
   }];

Tutorial: https://www.firebase.com/docs/ios/

Demo:

  1. iFirefeed: https://github.com/firebase/iFirefeed

  2. Login demo: https://github.com/firebase/login-demo-ios

** Sample of Web **

** Writing Data: **

   var Firebase = require("firebase");
   var myFirebaseRef = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com/");
   myFirebaseRef.set ({
       title: "Hello World!",
       author: "Firebase",
       location: {
           city: "San Francisco",
           state: "California"
       }
   });

**Reading Data: **

   myFirebaseRef.child("location/city").on("value", function(snapshot) {
       alert(snapshot.val());  // Alerts "San Francisco"
   });

Tutorial: https://www.firebase.com/docs/web/

Demo:

  1. Firepad: https://github.com/firebase/firepad

  2. Firechat: https://github.com/firebase/firechat

Why Firebase

Syncing data across different devices is a difficult problem to solve. Studies have indicated that companies can spend as much as 70% of their time on solving problems around Sync/Networking rather than spending that time on Business features.

Firebase-Graphic.jpg

References


All rights reserved

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí