October 2018
Intermediate to advanced
464 pages
15h 17m
English
Adding the Inline Reply option to a notification is actually very simple. We start with a Notification object as we've done in the previous recipes. (We're using NotifcationCompat from the support library to provide greater backward compatibility.) When creating the Action, call the addRemoteInput() method, passing in a RemoteInput. RemoteInput is where you define they key to retrieve the user input text. After the user enters a reply, the OS calls the PendingIntent, passing the data back to your app in an Intent. Use RemoteInput.getResultsFromIntent() to retrieve the user text as we did in the getReplyText() method.