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

Firebase: a great backend service for android a...

Firebase: a great backend service for android application

Today the world is all about connected devices, social media and internet. Building a mobile app also means think about a back-end. Sometime ago, mobile developers need to build their own back-end providing data storage, user authentication and some REST API. Nowadays back-end as service like Firebase can handle server side tasks and give interesting features to Mobile Applications.

In this talk we will explore Firebase for mobile applications. Then, after a brief explanation of the Firebase Structure, we will move into the technical part of the talk, where attendees will see how easy it is to integrate Firebase in Android Applications.
Finally The talk provides some Android Firebase examples about authentication, using data storage, security and working offline.

WillyShakes

March 08, 2016
Tweet

More Decks by WillyShakes

Other Decks in Programming

Transcript

  1. FIREBASE A great backend service for android application WILFRIED MBOUENDA

    MBOGNE / @EWILLY ANDROID DEVELOPER / @LINKYOURTHINGS
  2. REALTIME DATA Whenever data is updated in Firebase, it sends

    the update down to every listening client
  3. 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) { } });
  4. 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.
  5. EXTENDED 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.
  6. Firebase supports several forms of authentication Email & Password Google

    Twitter Facebook Github Anonymous ...and even custom backends
  7. 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 } });
  8. SECURITY { "rules": { ".read": true, ".write": true, } }

    By default everyone can write and read
  9. { "rules": { ".read": true, "message": { ".write": false }

    } } Secure specific parts of your Firebase
  10. { "rules": { ".read": true, "message": { ".write": "auth !==

    null", ".validate": "!data.exists()" } } } Special variables to power authentication
  11. { "rules": { ".read": false, ".write": false, "users": { "$userid":

    { ".read": "true", ".write": "auth.uid === $userid" } } } } Use $wildcardsas route parameters
  12. Create an account + app Install Firebase - gradle Add

    Internet permission - manifest Setup Firebase
  13. FOCUS ON YOUR APP The user doesn't care about the

    backend What matters is that your app is fast and enjoyable