void updatePresence(int status, String statusText) { if (mPresence == null) { // No connection yet. Don't allow to update presence yet. return; } Presence newPresence = new Presence(mPresence); if (status != -1) { newPresence.setStatus(status); } if (statusText != null) newPresence.setStatusText(statusText); try { int res = mConn.updateUserPresence(newPresence); if (res != ImErrorInfo.NO_ERROR) { mHandler.showAlert(R.string.error, ErrorResUtils.getErrorRes(getResources(), res)); } else { mPresence = newPresence; updateView(); } } catch (RemoteException e) { mHandler.showServiceErrorAlert(); } }
public Presence( int status, String statusText, byte[] avatarData, String avatarType, int clientType, Map<String, String> extendedInfo, String resource) { setStatus(status); mStatusText = statusText; setAvatar(avatarData, avatarType); mClientType = clientType; mExtendedInfo = extendedInfo; mResource = resource; }