Slide 1

Slide 1 text

Building compelling Android apps with Firebase GDG Ajah Cloud Study Jam April 6th, 2019

Slide 2

Slide 2 text

Hi, I’m Adora! Multidisciplinary software engineer GDG Ajah Co-organizer Women Techmakers Ajah Ambassador Blogger, adorahack.com Twitter @theadoranwodo GitHub @adoranwodo 2

Slide 3

Slide 3 text

Introducing Firebase Firebase products A basic android app with Firebase Other awesome stuff to do with Firebase 3

Slide 4

Slide 4 text

Introducing Firebase 4

Slide 5

Slide 5 text

Firebase is a web and mobile platform that gives developers a variety of tools to build high quality apps 5

Slide 6

Slide 6 text

Firebase Products 6

Slide 7

Slide 7 text

Cloud Firestore NoSQL Database ML Kit Machine Learning APIs Cloud Functions & Storage 7 Authentication Manage your users efficiently Hosting Simple & Secure hosting Realtime Database NoSQL

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

A basic Android app with Firebase 9

Slide 10

Slide 10 text

Imagine we had an already existing app that has a list of motivational quotes on SQLite. If we add a new quote to the app, we have to update the app on the store and our users have to redownload. That’s NOT good enough! Place your screenshot here 10 Motivational Quotes App

Slide 11

Slide 11 text

11 It separates the data from the app It also works offline Your users don’t have to download a new version of your app when you update data Crash reporting A good idea would be to integrate Firebase. Here’s why

Slide 12

Slide 12 text

On your marks, set, create Firebase quotes app.

Slide 13

Slide 13 text

The Final Product 13 Place your screenshot here Quotes are now retrieved from the cloud firestore. https://github.com/AdoraNwodo/bookofquotes

Slide 14

Slide 14 text

Quotes app Step 1: On Android studio, go to Tools > Firebase. This will launch a sidebar that looks like this on the right side of your project. 14

Slide 15

Slide 15 text

Quotes app Step 2: Connect your app to Firebase (by clicking on the button provided) Step 3: Add Cloud Firestore to your app (again, by clicking on the button provided). If you’re having issues syncing your project afterwards, go to your app level build.grade and change what looks like the below: implementation 'com.google.firebase:firebase-firestore:18.2.0:15.0.0' to implementation 'com.google.firebase:firebase-firestore:18.2.0' 15

Slide 16

Slide 16 text

Quotes app Step 4: Go to firebase and add some quotes to your project. Also secure your quotes data. Step 5: Create a firebase firestore instance val db = FirebaseFirestore.getInstance() 16

Slide 17

Slide 17 text

Quotes app Step 6: Create a quotes data class. data class Quote(val id: String, val quote: String, val author: String ) Step 7: Create a recyclerview in activity_main.xml 17

Slide 18

Slide 18 text

Quotes app Step 8: Create an xml card layout for a single quote. Feel free to get creative. 18

Slide 19

Slide 19 text

Quotes app Step 9: Create an adapter class for your recyclerview. Step 10: Create a method to initialize recyclerview in your Activity. Step 11: Now, we have these things set up, it’s time to retrieve data from firestore with the instance that was initially created. 19

Slide 20

Slide 20 text

Quotes app db.collection("quotes") .get() .addOnCompleteListener { task -> if (task.isSuccessful) { for (document in task.result!!) { quotesList.add( Quote(document.id,document["quote"].toString(), document["author"].toString())) } initRecyclerView(quotesList) //method to initialize recyclerview } else { Log.w("QUOTE_ERROR_TAG", "Error getting documents.", task.exception) } } 20

Slide 21

Slide 21 text

Moral of the Story The firebase part in the implementation was just two. 1. Instantiating Firestore 2. Retrieving data from store Yo! Apart from the fact that it’s a good tool for your apps, it saves you a lot of time . 21

Slide 22

Slide 22 text

What else can I do with Firestore? 22

Slide 23

Slide 23 text

More on Firestore Write to the store Perform simple and compound queries Order queries Limit queries 23

Slide 24

Slide 24 text

Other awesome stuff to do with Firebase 24

Slide 25

Slide 25 text

25 Create an (easily trackable) onboarding flow Use personalization efficiently for better experiences Get a deep understanding of users across devices Leverage machine learning Add realtime chat with an offline experience

Slide 26

Slide 26 text

26 https://firebase.google.com The Definitive Guide to Firebase: Build Android Apps on Google's Mobile Platform - Laurence Moroney Mastering Firebase for Android Development: Build Real-time, Scalable, and Cloud-enabled Android Apps with Firebase - Ashok Kumar S Firebase Cookbook: Over 70 recipes to help you create real-time web and mobile applications with Firebase - Houssem Yahiaoui Resources to help you get started with Firebase

Slide 27

Slide 27 text

Thanks! www.adoranwodo.com www.adorahack.com Twitter - @theadoranwodo 27