Android Notification New features in Android 8.0+

With Android Notification in the Android app, you can give a message to the user like Reminders, Alert, Messages, etc even app not running or using. All most all Android apps sending a notification to customer or users. Like Flipkart, Amazon e-commerce apps sending about sells and other useful notification. Whats app sending notification about new chat message no top of the android phone, you can tap the notification to open an app or take an action directly from the notification.

Android Notification New features in Android 8.0+ icon

Android Notification structure:

  • Small icon: Required and set with setSmallIcon().
  • App name: This is provided by the system.
  • Timestamp: Provided by the system but you can override with setWhen() or hide it with setShowWhen(false).
  • Title: optional and set with setContentTitle().
  • Text:  Its for details, optional and set with setContentText().

Android Notification New features in Android 8.0+ oreo p

It’s a basic detail of Android notification, it can vary with a version to version android os.

Sourcehttps://developer.android.com/guide/topics/ui/notifiers/notifications

 

Notification Channels

From Android 8.0 (API level 26), all notifications must be assigned to a channel.

You can create multiple channels and for each channel, you can set diffract behavior and visual. The user can decide or set the setting which notification channels form app should be visible at all.

Check out this official video for an overview of channels and other new notification features in Android 8.0.

 

After you create a notification channel, you cannot change the notification behaviors—the user has complete control at that point. But you can still change a channel’s name and description.

 

How Notifications show on Android devices :

  • Status bar and notification drawer
  • Lock Screen
  • Heads-up notification
  • App icon badge

 

Let’s Build a Simple app for Android Application 

Step 1. Create a new project “ Build Your First Android App in Kotlin “
Step 2. Create class NotificationHelper.java extends ContextWrapper

Step 3. Add Strings in  a “strings.xml” resource file

Step 4. Open an “activity_main.xml” resource file

add button and following

Step 5. Add the following code in “MainActivity.xml”

Step 6. Run the application, in the emulator or On your android device
Output screenshot Android Notification example in Android :

 

Android Notification New features in Android 8.0+ oreo p output

Video Output

Download source code Android Android Notification example

https://github.com/EyeHunts/AndroidNotification

Note : This example (Project) is developed in Android Studio 3.1.3 . Tested on Android 9 ( Android-P), compile SDK version API 26: Android 8.0 (Oreo)

MinSdkVersion=”26″

TargetSdkVersion=”27″

Coding in Java

For open a notification you have to Add create Intent. Where Pending Intent waiting for trigger an action, Once a user clicks on the notification it will open particular comments lime Activity or any.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.