ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Notifications on Android — The basics

Thomas Middel
ProAndroidDev
Published in
4 min readJun 12, 2019
Found on Pubnub

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!

Did you get my message?

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Responses (2)

Write a response