Read More
Read now

Direct Reply from Notification

Save

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

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home