Android1/14/2020

Android Notification Channels Tutorial — Modern Push Notification System

Notifications are one of the most important features in Android applications.

Modern Android apps use notifications for:

  • Messages and chats
  • Order updates
  • Downloads
  • Media playback
  • Reminders and alerts
  • Background services

Since Android Oreo (API 26), Notification Channels became mandatory for displaying notifications.

In this tutorial, we will learn:

  • What Notification Channels are
  • How to create notification channels
  • How to send notifications
  • Modern notification best practices
  • Notification priorities and importance levels

What Are Notification Channels?

Notification Channels allow Android users to control notification behavior for different categories inside an app.

Examples:

  • Chat messages
  • Promotions
  • Order alerts
  • Download progress

Users can individually control:

  • Sound
  • Vibration
  • Priority
  • Popup behavior
  • Lockscreen visibility

Why Notification Channels Are Important

Android 8.0 (API level 26) requires every notification to belong to a notification channel.

Without channels:

  • Notifications will not appear
  • Users lose notification customization control
  • Apps may behave inconsistently across Android versions

What We Will Build

In this Android example:

  • Create two notification channels
  • Send notifications on different channels
  • Use NotificationCompat
  • Support modern Android versions

Step 1 — Configure AndroidManifest.xml

Inside:


AndroidManifest.xml

Add custom Application class:


<application
    android:name=".App"
    android:allowBackup="true"
    android:theme="@style/Theme.App">

    <activity
        android:name=".MainActivity">

        <intent-filter>

            <action
                android:name=
                "android.intent.action.MAIN" />

            <category
                android:name=
                "android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>

</application>

Step 2 — Create Notification Channels

Create:


App.java

Add the following code:


package com.example.notifications;

import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;

public class App extends Application {

    public static final String CHANNEL_1_ID =
            "channel1";

    public static final String CHANNEL_2_ID =
            "channel2";

    @Override
    public void onCreate() {

        super.onCreate();

        createNotificationChannels();
    }

    private void createNotificationChannels() {

        if (Build.VERSION.SDK_INT
                >= Build.VERSION_CODES.O) {

            NotificationChannel channel1 =
                    new NotificationChannel(
                            CHANNEL_1_ID,
                            "Important Notifications",
                            NotificationManager
                                    .IMPORTANCE_HIGH
                    );

            channel1.setDescription(
                    "High priority notifications"
            );

            NotificationChannel channel2 =
                    new NotificationChannel(
                            CHANNEL_2_ID,
                            "General Notifications",
                            NotificationManager
                                    .IMPORTANCE_LOW
                    );

            channel2.setDescription(
                    "Low priority notifications"
            );

            NotificationManager manager =
                    getSystemService(
                            NotificationManager.class
                    );

            manager.createNotificationChannel(
                    channel1
            );

            manager.createNotificationChannel(
                    channel2
            );
        }
    }
}

Step 3 — Create activity_main.xml


<LinearLayout
    xmlns:android=
    "http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp">

    <EditText
        android:id="@+id/editTextTitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Title" />

    <EditText
        android:id="@+id/editTextMessage"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Message" />

    <Button
        android:id="@+id/buttonChannel1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Send High Priority" />

    <Button
        android:id="@+id/buttonChannel2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Send Low Priority" />

</LinearLayout>

Step 4 — Create MainActivity.java


package com.example.notifications;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;

import android.app.Notification;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity
        extends AppCompatActivity {

    private EditText editTextTitle;

    private EditText editTextMessage;

    private NotificationManagerCompat
            notificationManager;

    @Override
    protected void onCreate(
            Bundle savedInstanceState
    ) {

        super.onCreate(savedInstanceState);

        setContentView(
                R.layout.activity_main
        );

        notificationManager =
                NotificationManagerCompat
                        .from(this);

        editTextTitle =
                findViewById(
                        R.id.editTextTitle
                );

        editTextMessage =
                findViewById(
                        R.id.editTextMessage
                );

        Button buttonChannel1 =
                findViewById(
                        R.id.buttonChannel1
                );

        Button buttonChannel2 =
                findViewById(
                        R.id.buttonChannel2
                );

        buttonChannel1.setOnClickListener(v -> {

            sendNotificationChannel1();
        });

        buttonChannel2.setOnClickListener(v -> {

            sendNotificationChannel2();
        });
    }

    private void sendNotificationChannel1() {

        Notification notification =
                new NotificationCompat.Builder(
                        this,
                        App.CHANNEL_1_ID
                )

                .setSmallIcon(
                        R.drawable.ic_notification
                )

                .setContentTitle(
                        editTextTitle
                                .getText()
                                .toString()
                )

                .setContentText(
                        editTextMessage
                                .getText()
                                .toString()
                )

                .setPriority(
                        NotificationCompat
                                .PRIORITY_HIGH
                )

                .build();

        notificationManager.notify(
                1,
                notification
        );
    }

    private void sendNotificationChannel2() {

        Notification notification =
                new NotificationCompat.Builder(
                        this,
                        App.CHANNEL_2_ID
                )

                .setSmallIcon(
                        R.drawable.ic_notification
                )

                .setContentTitle(
                        editTextTitle
                                .getText()
                                .toString()
                )

                .setContentText(
                        editTextMessage
                                .getText()
                                .toString()
                )

                .setPriority(
                        NotificationCompat
                                .PRIORITY_LOW
                )

                .build();

        notificationManager.notify(
                2,
                notification
        );
    }
}

Understanding Notification Importance Levels

Importance Behavior
IMPORTANCE_HIGH Popup + sound + heads-up
IMPORTANCE_DEFAULT Sound only
IMPORTANCE_LOW Silent notification
IMPORTANCE_MIN Background only

NotificationCompat vs Notification

Modern Android apps should use:


NotificationCompat

because it provides:

  • Backward compatibility
  • Better feature support
  • Consistent behavior across devices

Modern Android Notification Features

Android notifications now support:

  • Action buttons
  • Direct reply
  • Progress bars
  • Media controls
  • MessagingStyle
  • BigPictureStyle
  • Grouped notifications
  • Foreground services

Common Notification Mistakes

1. Forgetting Notification Channels

Notifications will not appear on Android Oreo+ without channels.


2. Using High Priority Everywhere

Overusing high-priority notifications annoys users.


3. Missing Notification Permission

Android 13+ requires runtime notification permission:


POST_NOTIFICATIONS

Android 13 Notification Permission

For Android 13 and above:


<uses-permission
    android:name=
    "android.permission.POST_NOTIFICATIONS" />

Runtime permission request is also required.


Best Practices for Notifications

  • Use meaningful notification channels
  • Avoid spam notifications
  • Provide user customization
  • Use proper priorities
  • Group related notifications
  • Use deep links for navigation

FAQ

Why are notification channels required?

Android Oreo introduced channels to give users more control over notification behavior.

Can notification settings be changed later?

Once created, some channel settings become user-controlled and cannot be changed programmatically.

Should every notification have its own channel?

No. Channels should represent categories of notifications.


Conclusion

Notification Channels are a core part of modern Android notification systems.

Proper notification architecture improves:

  • User engagement
  • Notification management
  • Application usability
  • Android compatibility

Modern Android applications should combine NotificationCompat, runtime permissions, proper channel grouping, and user-friendly notification design for scalable notification experiences.


About the Author

Salil Jha is a Full Stack and Mobile Developer specializing in Android, React Native, fintech systems, scalable SaaS platforms, and developer tooling products.

CodeChain Dev — Build Modern Products. Solve Real Problems.

Deep Structural Diagnostics.

Mastering JSON is only the first step. Use our industrial-grade workbench to format, validate, and synthesize models for your production APIs.