Blog Engineering

Creating Push Notifications in Android O

Darshan Pania Darshan Pania, Associate Director with 12+ years in mobile tech, SDKs, and Gaming. Leads CleverTap's Mobile SDK & LiveOps team, passionate about innovative tech solutions.
Creating Push Notifications in Android O

The latest Android version named after the famous cookie brand Oreo released on 21st August and is now live on Google’s new phone Pixel 2. Since Google launched Pixel 2 on 19th October, everyone in the Android world has been racing to develop their apps for the latest version. If you have also started developing your app for the latest Android version, then this blog will help you through the fancy new push notification feature of Android O. In part 1 of this blog, I explained how to create Notification Channels and to use the Notification Badges. In this part, I will explain how you can use CleverTap to smoothly help you send Push Notifications to your Android O app with almost no coding effort.

Prerequisite

Since Notification channels and badges are the features of the latest Android version, you as a developer will have to update your SDK and Build tools to the latest versions. The latest SDK tools version is 26.0.2 and the latest Build tools version is 26.0.2. You will have to make sure that in your build.gradle file, the compileSdkVersion is 26 and buildToolsVersion is 26.0.1

android {
   compileSdkVersion 26
   buildToolsVersion "26.0.2"
}

Also your app should have integrated the CleverTap Android SDK to be able to send push notifications via the dashboard.

Creating Notification Channels

Once you have the CleverTap Android SDK integrated successfully, you can create a Notification channel in your app by using the following line of code –

CleverTapAPI cleverTapAPI = CleverTapAPI.getInstance(getApplicationContext());
cleverTapAPI.createNotificationChannel(getApplicationContext(),"YourChannelId","Your Channel Name","Your Channel Description",NotificationManager.IMPORTANCE_MAX,true);

You can create more than one channel using the above line of code, just make sure that the channel ID differs in every Notification Channel. Also this Channel ID will be used to send Push Notifications using the CleverTap dashboard.
Android O Push Notification

Sending Notifications via Dashboard

To send Push Notifications, login to the CleverTap Dashboard and on the left navigation menu click on Campaigns. Then click on +Campaign button on the top right to select Mobile Push
Notifications Dashboard
Now setup your push notification campaign by selecting when you want to send out your notification, who do you want to send it out to (in this case it will be Android users) and what kind of push notification you want to send out. Once you reach the what section, select the Single Message option.
Notifications Dashboard2
Select the check box which says Send Message to Android O.
Messaging on Android
Fill in the Channel with the channel id you used to create the notification channel in your app. This field is mandatory as Android O requires a valid channel to send notifications. Badge Icon can be set as the app icon or the small icon used to denote push notifications. Default is app icon. Badge ID is the number you want to set on the Notification Badge, by default it auto-increments. Both Badge Icon and Badge ID are optional.
Your notification will look like this once you schedule the campaign.
Android Oreo Push Notifications
That’s it, by using CleverTap sending Push Notifications to Android O is as simple as eating an Oreo cookie! 😉
Schedule a demo with one of our growth specialists to see CleverTap in action.

The Intelligent Mobile Marketing Platform

See how today’s top brands use CleverTap to drive long-term growth and retention.

Schedule a Demo Now!

Last updated on October 22, 2024