Monday , November 29 2021

Direct Reply Notification in Android like WhatsApp Tutorial – Android Coding by DMTechnolab

public Zero Display()) {{

// Pending intent for notification button named moring

Pending morePendingIntent = Pending.getBroadcast()

Main activity.this,

REQUEST_CODE_MORE,

New Intent()Main activity.this, Notification.class)

.son()KEY_INTENT_MORE, REQUEST_CODE_MORE),

Pending.FLAG_UPDATE_Present

);

// a notification button intended for help pending

Pending helpPendingIntent = Pending.getBroadcast()

Main activity.this,

REQUEST_CODE_HELP,

New Intent()Main activity.this, Notification.class)

.son()KEY_INTENT_HELP, REQUEST_CODE_HELP),

Pending.FLAG_UPDATE_Present

);

// We need this object to get input directly from notification

Remoteinput Remoteinput = New Remoteinput.Builder()NOTIFICATION_REPLY)

.Settabel()“Enter your name”)

.Construction());

// We need this action object for remote input

Notification.The verb The action =

New Notification.The verb.Builder()Android.R.Attractible.ic_delete,

“reply now…”, helpPendingIntent)

.addRemoteInput()Remoteinput)

.Construction());

// Create a notification builder object

Notification.Builder mBuilder = New Notification.Builder()this, CHANNNEL_ID)

.setSmallIcon()Android.R.Attractible.ic_dialog_email)

.setContentTitle()“Hey this is simplified coding …”)

.setContentText()“Please share your name with us”)

.setAutoCancel()True)

.setContentIntent()helpPendingIntent)

.AddAction()The action)

.AddAction()Android.R.Attractible.ic_menu_compass, “Excess”, morePendingIntent)

.AddAction()Android.R.Attractible.ic_menu_directions, “Help”, helpPendingIntent);

// Finally display the notification

Notification manager informer = ()Notification manager) getSystemService()NOTIFICATION_SERVICE);

informer.please inform()NOTIFICATION_ID, mBuilder.Construction()));

}


Source link

About dmtechnolab

Check Also

Simplified Coding

Android Espresso Tutorial – Testing Fragment in Isolation – Android Coding by DMTechnolab

Welcome to another tutorial in the Android test series. And this post is called Android …

Leave a Reply

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