Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase for Android

Dhrumil Shah
November 02, 2015

Firebase for Android

Basic introduction about Firebase and how easy it is to use for Android.

Dhrumil Shah

November 02, 2015
Tweet

More Decks by Dhrumil Shah

Other Decks in Programming

Transcript

  1. REALTIME DATA Whenever data is updated in Firebase, it sends

    the update down to every listening client
  2. SYNC DATA Firebase ref = new Firebase("https://<your-firebase-app>.firebaseio.com/message"); ref.addValueEventListener(new ValueEventListener() {

    @Override public void onDataChange(DataSnapshot snapshot) { System.out.println(snapshot.getValue()); } @Override public void onCancelled(FirebaseError error) { } });
  3. INTERMITTENT OFFLINE What happens when you go through a tunnel?

    Firebase clients store a local cache of your data. When the user goes offline, the app still works as expected with the local cache.
  4. ENTENDED OFFLINE What happens when you go on a flight?

    On mobile, Firebase persists data to a local store. The app will continue to work even across app restarts.
  5. Firebase supports several forms of authentication Email & Password Google

    Twitter Facebook Github Anonymous … and even custom backends
  6. AUTHENTICATION ref.authWithOAuthToken("google", "<OAuth Token>", new Firebase. AuthResultHandler() { @Override public

    void onAuthenticated(AuthData authData) { // the Google user is now authenticated with your Firebase app } @Override public void onAuthenticationError(FirebaseError firebaseError) { // there was an error } });
  7. SECURITY By default everyone can read and write { "rules":

    { ".read": true, ".write": true, } }
  8. SECURITY Everyone can read, but no one can write {

    "rules": { ".read": true, ".write": false, } }
  9. SECURITY Secure specific parts of your firebase { "rules": {

    ".read": true, “message”: { ".write": false, } } }
  10. FOCUS ON YOUR APP The user doesn’t care about the

    backend What matters is that your app is fast and enjoyable