Applozic Android SDK Tutorial 4 – Push Notifications using Firebase
Tags: android, tutorial, firebase, applozic
Published: 2021-06-30 12:58:03

<!-- wp:paragraph -->
<p>This tutorial is Part 4 of a multi-part series covering Applozic Android SDK integration into an Android app.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Our goal is to learn the following steps in this tutorial:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Create FCM key for your app in Firebase</li><li>Enable FCM notifications from Applozic dashboard</li><li>Integrate Firebase handler in your app</li><li>Process the received notifications</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You can download the sample Android chat app from&nbsp;<a rel="noreferrer noopener" href="https://github.com/AppLozic/Applozic-Android-SDK" target="_blank">Applozic GitHub</a>.</p>
<!-- /wp:paragraph -->

```
💡 If you already have FCM set up for your app, move directly to Step 2. 
```

<!-- wp:heading -->
<h2>Firebase and FCM key</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Firebase is a mobile application development platform from Google with powerful features for developing, handling, and enhancing highly functional and versatile web, Android, and iOS platform applications. </p>
<!-- /wp:paragraph -->

```
💡 FCM (Firebase Cloud Messaging) was previously called GCM (Google Cloud Messaging).
```


To learn more about Firebase's features and use cases, check out my [dev.to](https://dev.to/anuragjwrites/firebase-start-up-your-base-or-fire-up-your-own-servers-i2n) post: {% post https://dev.to/anuragjwrites/firebase-start-up-your-base-or-fire-up-your-own-servers-i2n %}

<!-- wp:heading {"level":3} -->
<h3>Generate FCM key in Firebase</h3>
<!-- /wp:heading -->

Login to the&nbsp;<a href="https://console.firebase.google.com/">Firebase Developer Console</a> and click on "<strong>Create a project</strong>".

<!-- wp:image {"id":2185,"width":719,"height":713,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-17.png" alt="Firebase main screen" class="wp-image-2185" width="719" height="713"/><figcaption>Firebase Main Screen</figcaption></figure>
<!-- /wp:image -->

In your project dashboard, click on the "<strong>Settings" </strong>icon &gt; "<strong>Project </strong>settings".

<!-- wp:image {"id":2186,"width":444,"height":434,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-18.png" alt="Project settings" class="wp-image-2186" width="444" height="434"/><figcaption>Project settings</figcaption></figure>
<!-- /wp:image -->

Go to the<strong> "Cloud Messaging" </strong>tab.

<!-- wp:image {"id":2187,"width":711,"height":165,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-19.png" alt="Cloud Messaging tabs" class="wp-image-2187" width="711" height="165"/><figcaption>Cloud Messaging tabs</figcaption></figure>
<!-- /wp:image -->

The "<strong>Server key" </strong>and the "<strong>Sender ID</strong>" are your private credentials. <br>Leave this tab open and proceed to the next step.

<!-- wp:image {"id":2188,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-20-1024x808.png" alt="Server key location" class="wp-image-2188"/><figcaption>Server key location</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Set up FCM Notifications</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The Server key is an API key that is a unique string used to route requests to your Firebase project when interacting with Firebase and Google services.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Your FCM credentials are unique to the project you have created, so keep them secure and do not share them with anyone.  </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Update FCM Server key in Applozic Dashboard.</h3>
<!-- /wp:heading -->

Go to your&nbsp;<strong><a href="https://console.applozic.com/settings/pushnotification">Appl</a><a rel="noreferrer noopener" href="https://console.applozic.com/settings" target="_blank">ozic Dashboard.</a></strong> Click on "Settings".

<!-- wp:image {"id":2193,"width":350,"height":149,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-21.png" alt="Settings in Applozic Dashboard." class="wp-image-2193" width="350" height="149"/><figcaption>Settings in Applozic Dashboard</figcaption></figure>
<!-- /wp:image -->

Click on "Chat" > "Notifications".

<!-- wp:image {"id":2194,"width":768,"height":489,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-22-1024x652.png" alt="Notification tab under Chat" class="wp-image-2194" width="768" height="489"/><figcaption>Notification tab under Chat</figcaption></figure>
<!-- /wp:image -->

Click "Add Credentials" under FCM and paste the "Server Key" from Firebase credentials.

<!-- wp:image {"id":2196,"width":549,"height":410,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://www.applozic.com/blog/wp-content/uploads/2021/06/image-23.png" alt="Add FCM Credentials" class="wp-image-2196" width="549" height="410"/><figcaption>Add FCM Credentials</figcaption></figure>
<!-- /wp:image -->

Voila! Your app is set up for use with FCM. 

##Continue this Tutorial on Applozic Blog!
We have the detailed tutorial with code snippets available on [our blog](https://www.applozic.com/blog/applozic-android-sdk-tutorial-4-push-notifications-firebase/) for you to continue with your integration!

[Click here](https://www.applozic.com/blog/applozic-android-sdk-tutorial-4-push-notifications-firebase/) to learn how to:
* Integrate FCM in your application
* Process the received notifications