Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mFirebaseTextMessages.add(FirebaseTextMessage.createForRemoteUser(messageToDisplay, System.currentTimeMillis(), "a"));
- suggestReplies();
- private void suggestReplies(){
- mFirebaseSmartReply.suggestReplies(mFirebaseTextMessages)
- .addOnSuccessListener(new OnSuccessListener<SmartReplySuggestionResult>() {
- @Override
- public void onSuccess(SmartReplySuggestionResult result) {
- if (result.getStatus() == SmartReplySuggestionResult.STATUS_NOT_SUPPORTED_LANGUAGE) {
- // The conversation's language isn't supported, so the
- // the result doesn't contain any suggestions.
- } else if (result.getStatus() == SmartReplySuggestionResult.STATUS_SUCCESS) {
- // Task completed successfully
- // ...
- suggestionList.clear();
- for (SmartReplySuggestion suggestion : result.getSuggestions()) {
- String replyText = suggestion.getText();
- Log.d(TAG, replyText);
- suggestionList.add(replyText);
- }
- mSuggestionAdapter.notifyDataSetChanged();
- mRecyclerView.setVisibility(View.VISIBLE);
- }
- }
- })
- .addOnFailureListener(new OnFailureListener() {
- @Override
- public void onFailure(@NonNull Exception e) {
- // Task failed with an exception
- // ...
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement