@Override public void onNotice(CallManager.HMediaNoticeCode code, String arg1, String arg2, Object arg3) { switch (code){ case HMediaNoticeOpenCameraFail: EMLog.e(TAG, "onNotice:HMediaNoticeOpenCameraFail"); break; case HMediaNoticeOpenMicFail: EMLog.e(TAG, "onNotice:HMediaNoticeOpenMicFail"); break; } }
@Override public void onConnect(int rst) { EMLog.d("HWHMSPush", "huawei hms push connect result code:" + rst); } });
@Override public void surfaceDestroyed(SurfaceHolder arg0) { EMLog.v("video", "surfaceDestroyed"); }
@Override public void onToken(Context context, String token) { //没有失败回调,假定token失败时token为null if (!TextUtils.isEmpty(token)){ EMLog.d("HWHMSPush", "register huawei hms push token success token:" + token); ChatClient.getInstance().sendHMSPushTokenToServer("10663060", token); }else{ EMLog.e("HWHMSPush", "register huawei hms push token fail!"); } } }
@Override public void onUpdate(List<String> list) { EMLog.i(TAG, "onUpdate: " + list.size()); userList.clear(); userList.addAll(list); runOnUiThread(new Runnable() { @Override public void run() { userAdapter.notifyDataSetChanged(); } }); } };
@Override public void onClick(View v) { // TODO: send the ding-type msg. EMLog.i(TAG, "Click to send ding-type message."); String msgContent = msgEidtText.getText().toString(); Intent i = new Intent(); i.putExtra("msg", msgContent); setResult(RESULT_OK, i); finish(); } });
/** * user met some exception: conflict, removed or forbidden */ protected void onUserException(String exception){ EMLog.e(TAG, "onUserException: " + exception); // Intent intent = new Intent(getBaseContext(), UserQrCodeActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.putExtra(exception, true); // this.startActivity(intent); }
@Override public void onResult(int rst) { EMLog.d("HWHMSPush", "get huawei hms push token result code:" + rst); } });
@Override public void surfaceDestroyed(SurfaceHolder arg0) { EMLog.v("video", "surfaceDestroyed"); }
EMLog.i(TAG, "To send the ding-type msg, content: " + msgContent);
/** * user met some exception: conflict, removed or forbidden */ protected void onUserException(Context context, String exception){ EMLog.e(TAG, "onUserException: " + exception); Toast.makeText(context,exception,Toast.LENGTH_LONG).show(); Intent intent = new Intent(context, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(exception, true); context.startActivity(intent); }
@Override public void onNotice(CallManager.HMediaNoticeCode code, String arg1, String arg2, Object arg3) { switch (code){ case HMediaNoticeOpenCameraFail: EMLog.d(TAG, "onNotice:HMediaNoticeOpenCameraFail"); break; case HMediaNoticeOpenMicFail: EMLog.d(TAG, "onNotice:HMediaNoticeOpenCameraFail"); break; } }
@Override public void surfaceDestroyed(SurfaceHolder arg0) { EMLog.v("video", "surfaceDestroyed"); }
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.ease_activity_ding_ack_user_list); ackUserListView = (ListView) findViewById(R.id.list_view); titleBar = (EaseTitleBar) findViewById(R.id.title_bar); titleBar.setTitle(getString(R.string.title_ack_read_list)); // Set the title bar left layout click listener to back to previous activity. titleBar.setLeftLayoutClickListener(new View.OnClickListener() { @Override public void onClick(View v) { back(v); } }); msg = getIntent().getParcelableExtra("msg"); EMLog.i(TAG, "Get msg from intent, msg: " + msg.toString()); userList = new ArrayList<>(); userAdapter = new AckUserAdapter(this, userList); ackUserListView.setAdapter(userAdapter); }
@Override public void onError(MediaRecorder mr, int what, int extra) { EMLog.e("video", "recording onError:"); stopRecording(); Toast.makeText(this, "Recording error has occurred. Stopping the recording", Toast.LENGTH_SHORT).show(); }
@Override public void onCmdMessageReceived(List<EMMessage> messages) { for (EMMessage message : messages) { EMLog.d(TAG, "receive command message"); //get message body //end of red packet code //获取扩展属性 此处省略 //maybe you need get extension of your message //message.getStringAttribute(""); } }
@Override public void onInfo(MediaRecorder mr, int what, int extra) { EMLog.v("video", "onInfo"); if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) { EMLog.v("video", "max duration reached"); stopRecording(); btn_switch.setVisibility(View.VISIBLE); chronometer.stop(); btnStart.setVisibility(View.VISIBLE); btnStop.setVisibility(View.INVISIBLE); chronometer.stop(); if (localPath == null) { return; } String st3 = getResources().getString(R.string.Whether_to_send); new AlertDialog.Builder(this) .setMessage(st3) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { arg0.dismiss(); sendVideo(null); } }).setNegativeButton(R.string.cancel, null) .setCancelable(false).show(); } }
public void sendAckMessage(EMMessage message) { if (!validateMessage(message)) { return; } if (message.isAcked()) { return; } // May a user login from multiple devices, so do not need to send the ack msg. if (EMClient.getInstance().getCurrentUser().equalsIgnoreCase(message.getFrom())) { return; } try { // cmd-type message will not store in native database. EMMessage msg = EMMessage.createSendMessage(EMMessage.Type.CMD); msg.setTo(message.getFrom()); msg.setAttribute(KEY_CONVERSATION_ID, message.getTo()); msg.setAttribute(KEY_DING_ACK, true); msg.addBody(new EMCmdMessageBody(message.getMsgId())); EMClient.getInstance().chatManager().sendMessage(msg); message.setAcked(true); EMLog.i(TAG, "Send the group ack cmd-type message."); } catch (Exception e) { } }
@Override public void onError(MediaRecorder mr, int what, int extra) { EMLog.e("video", "recording onError:"); stopRecording(); Toast.makeText(this, "Recording error has occurred. Stopping the recording", Toast.LENGTH_SHORT).show(); }
public static String getThumbnailImagePath(String imagePath) { String path = imagePath.substring(0, imagePath.lastIndexOf("/") + 1); path += "th" + imagePath.substring(imagePath.lastIndexOf("/")+1, imagePath.length()); EMLog.d("msg", "original image path:" + imagePath); EMLog.d("msg", "thum image path:" + path); return path; } }