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

Devfest SouthWest, Nigeria - Firebase

Devfest SouthWest, Nigeria - Firebase

This presentation contains an introduction to Firebase and walks through a code-lab for creating a real-time Android Chat application with offline functionality.

Moyinoluwa Adeyemi

November 28, 2015
Tweet

More Decks by Moyinoluwa Adeyemi

Other Decks in Technology

Transcript

  1. BUILDING REALTIME MOBILE APPS WITH FIREBASE
    Moyinoluwa ADEYEMI
    November 28, 2015

    View full-size slide

  2. Firebase is a powerful platform for building realtime feature-rich apps

    View full-size slide

  3. Realtime Database
    NoSQL JSON data store
    Cross-platform client-side
    SDKs
    Restful API
    Works Offline
    Auto-scaling

    View full-size slide

  4. Authentication
    Anonymous
    Email / password
    Social
    Custom

    View full-size slide

  5. Hosting
    Free static asset hosting
    SSL certificate
    Global CDN
    Single command deploys
    One-click rollbacks
    Custom domains

    View full-size slide

  6. So you want to learn how to build a
    realtime mobile chat application with Firebase?

    View full-size slide

  7. Sign up on https://www.firebase.com/ to get a firebase (data) url

    View full-size slide

  8. Add the library dependency directly to your app’s gradle.build file
    In cases of build errors caused by duplicate files, exclude those files by
    adding these too

    View full-size slide

  9. Connect your app to Firebase

    View full-size slide

  10. Edit your AndroidManifest.xml file
    First, request an INTERNET permission in the tag
    Next, change the name of the application

    View full-size slide

  11. Create a Chat Model class

    View full-size slide

  12. Send a message to Firebase
    Create a new Activity, complete with a layout that looks better than this.
    Be sure to add a , an for collecting messages
    and a for sending the data.

    View full-size slide

  13. Send a message to Firebase
    Create a reference to Firebase in the Activity and insert your own
    firebase url.

    View full-size slide

  14. Send a message to Firebase
    Retrieve the text from the EditText and push to Firebase

    View full-size slide

  15. Retrieve a message from Firebase
    Create a layout for the chat. It could look like this, or even better

    View full-size slide

  16. Retrieve a message from Firebase
    Create a ChatAdapter class that extends FirebaseListAdapter

    View full-size slide

  17. Retrieve a message from Firebase
    Create a ChatAdapter class that extends FirebaseListAdapter

    View full-size slide

  18. Retrieve a message from Firebase
    Override onStart() in MainActivity to read and display the messages

    View full-size slide

  19. Retrieve a message from Firebase
    Override onStop() in MainActivity to remove all the data

    View full-size slide

  20. Implement offline functionality with Firebase
    With just one line of code… seriously

    View full-size slide

  21. Woohoo!!!
    You now have a very basic Firebase app that sends, receives, displays
    messages and functions offline.

    View full-size slide

  22. Credits
    The official Firebase Chat App example was modified to produce this app.
    The complete app including Login functionality implemented with
    Firebase is available on Github here:
    https://github.com/moyheen/LagosFirebaseCodelab

    View full-size slide

  23. Twitter LinkedIn Github
    Moyinoluwa ADEYEMI
    Thank You!

    View full-size slide