发送消息
ExecutorService executorService = threadPoolExecuter.getThreadPoolExecutor();
executorService.shutdownNow();
接收消息
private void sendMessage() {
final String messageText = messageArea.getText().toString();
if (TextUtils.isEmpty(messageText)) {
Toast.makeText(getApplicationContext(), "Can't Send Blank Message", Toast.LENGTH_SHORT).show();
} else {
String message_sender_ref = "Messages/" + MessageSenderId + "/" + MessageRecieverId;
String message_reciver_ref = "Messages/" + MessageRecieverId + "/" + MessageSenderId;
Map messageTextBody = new HashMap<>();
messageTextBody.put("Message", messageText);
messageTextBody.put("Seen", false);
messageTextBody.put("Type", "Text");
messageTextBody.put("Time", ServerValue.TIMESTAMP);
messageTextBody.put("From", MessageSenderId);
DatabaseReference user_message_key;
user_message_key = mDatabaseReference.child("Messages").child(MessageSenderId).child(MessageRecieverId);
message_push_id = user_message_key.push().getKey();
final Map messageBodyDetails = new HashMap();
messageBodyDetails.put(message_sender_ref + "/" + message_push_id, messageTextBody);
messageBodyDetails.put(message_reciver_ref + "/" + message_push_id, messageTextBody);
messageArea.setText("");
我想检查对方是否已收到我的消息。我不是在谈论可见功能。只是收到的功能,如whatsapp doubletick。无法接收的2种可能性将是应用程序卸载或没有互联网。那么,如何检测对方是否收到了我的消息? Firebase或Java中是否有方法或实现该方法的方法?