Member-only story
Notifications on Android — The basics

Sending a notification to your users can be very beneficial when it comes to user-engagement, but can also feel intrusive when done too often. Let’s have a quick look at the basics for implementing push notifications on Android to get you started!
Getting everything fired up
To get everything started we need to get Firebase setup in our application. To do that, we first have to create a project in the Firebase console. Once that is set up, we can add our app to the project. Just click on your project and follow up by pressing the ‘+ Add app’ button (if you see it) and then the Android icon. You’ll end up filling in some basic information about your app and also downloading the google-services.json
configuration file which is necessary to connect your app to Firebase eventually, but we’ll get back to that later. For now, that’s all you’ll have to do in the Firebase console!
Connecting your app to Firebase
Let’s get to the fun stuff now. In your Android project, open up the project’s build.gradle
file. Make sure you add Google’s maven repository in both your repositories
block as well as the allprojects
block and also put the Google Services plugin in your dependencies as shown here:
Let’s move on to the app’s build.gradle
file. We’ll add our Firebase Core dependency here and also apply the Google Services plugin at the bottom of the file:
Almost there! Remember that google-services.json
configuration file we downloaded from the Firebase console? We’re just going to need to put that in our app
directory and we’re all set, you just set up Firebase in your app!