Redeem Now
Read More
Read now

Direct Reply from Notification

The Direct reply is the feature where a user sends a message from the notification itself without using the app’s UI. Users can tap the notification to open your app or take an action directly from the notification. The direct reply feature was introduced in Android 7.

What is notification

A notification is a message that Android displays outside your application to provide the user with reminders, communication from other people, or other timely information from your app. Users can tap the notification to open your app or take an action directly from the notification.

Let’s start with the coding

  1. Creating the notification channel on the onCreate method because from android Nougat it compulsory to add the notification channel and created a button click listener to generate a notification of a direct reply.
  2. First, we have to create the pending intent which will be used when an action is performed to apply the receiver class to listen to it and perform actions according to it.
  3. Also Created an instance of RemoteInput.Builder that you can add to your notification action. This will accept a string that the system uses as the key for the text input.
  4. After that, the app uses that key to retrieve the text of the input. The NotificationCompat.Action.Builder object is used when the system prompts the user to input a response when they trigger the notification action.

 

 

As all the code is completed, now let’s run the app:

 

 

. . . . . . . . .

 

That’s it from my side for today, thanks for reading it until now. If you want to read more about the notification check the official document: Click here

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close