@Override public IChatMessage sendMessage(final String text) throws RemoteException {
  if (TextUtils.isEmpty(text)) {
    throw new ServerApiIllegalArgumentException("GroupChat message must not be null or empty!");
  }
  int messageLength=text.length();
  int maxMessageLength=mRcsSettings.getMaxGroupChatMessageLength();
  if (messageLength > maxMessageLength) {
    throw new ServerApiIllegalArgumentException("chat message length: " + messageLength + " exceeds max group chat message length: "+ maxMessageLength+ "!");
  }
  if (!isAllowedToSendMessage()) {
    throw new ServerApiPermissionDeniedException("Not allowed to send GroupChat message on the connected IMS server!");
  }
  try {
    mImService.removeGroupChatComposingStatus(mChatId);
    long timestamp=System.currentTimeMillis();
    final ChatMessage msg=ChatUtils.createTextMessage(null,text,timestamp,timestamp);
    ChatMessagePersistedStorageAccessor persistedStorage=new ChatMessagePersistedStorageAccessor(mMessagingLog,msg.getMessageId(),msg.getRemoteContact(),text,msg.getMimeType(),mChatId,Direction.OUTGOING);
    addOutgoingGroupChatMessage(msg,Content.Status.QUEUED,Content.ReasonCode.UNSPECIFIED);
    if (!mChatService.isGroupChatActive(mChatId)) {
      mChatService.setGroupChatStateAndReasonCode(mChatId,GroupChat.State.STARTED,GroupChat.ReasonCode.UNSPECIFIED);
    }
    mImService.tryToDequeueGroupChatMessagesAndGroupFileTransfers(mChatId);
    return new ChatMessageImpl(persistedStorage);
  }
 catch (  ServerApiBaseException e) {
    if (!e.shouldNotBeLogged()) {
      sLogger.error(ExceptionUtil.getFullStackTrace(e));
    }
    throw e;
  }
catch (  Exception e) {
    sLogger.error(ExceptionUtil.getFullStackTrace(e));
    throw new ServerApiGenericException(e);
  }
}

@ Override public IChatMessage sendMessage ( final String text ) throws RemoteException { if ( TextUtils . isEmpty ( text ) ) { throw new ServerApiIllegalArgumentException ( "GroupChat message must not be null or empty!" ) ; } int messageLength = text . length ( ) ; int maxMessageLength = mRcsSettings . getMaxGroupChatMessageLength ( ) ; if ( messageLength > maxMessageLength ) { throw new ServerApiIllegalArgumentException ( "chat message length: " + messageLength + " exceeds max group chat message length: " + maxMessageLength + "!" ) ; } if ( ! isAllowedToSendMessage ( ) ) { throw new ServerApiPermissionDeniedException ( "Not allowed to send GroupChat message on the connected IMS server!" ) ; } try { mImService . removeGroupChatComposingStatus ( mChatId ) ; long timestamp = System . currentTimeMillis ( ) ; final ChatMessage msg = ChatUtils . createTextMessage ( null , text , timestamp , timestamp ) ; ChatMessagePersistedStorageAccessor persistedStorage = new ChatMessagePersistedStorageAccessor ( mMessagingLog , msg . getMessageId ( ) , msg . getRemoteContact ( ) , text , msg . getMimeType ( ) , mChatId , Direction . OUTGOING ) ; addOutgoingGroupChatMessage ( msg , Content . Status . QUEUED , Content . ReasonCode . UNSPECIFIED ) ; if ( ! mChatService . isGroupChatActive ( mChatId ) ) { mChatService . setGroupChatStateAndReasonCode ( mChatId , GroupChat . State . STARTED , GroupChat . ReasonCode . UNSPECIFIED ) ; } mImService . tryToDequeueGroupChatMessagesAndGroupFileTransfers ( mChatId ) ; return new ChatMessageImpl ( persistedStorage ) ; } catch ( ServerApiBaseException e ) { if ( ! e . shouldNotBeLogged ( ) ) { sLogger . error ( ExceptionUtil . getFullStackTrace ( e ) ) ; } throw e ; } catch ( Exception e ) { sLogger . error ( ExceptionUtil . getFullStackTrace ( e ) ) ; throw new ServerApiGenericException ( e ) ; } }
sends a text message to the group
