q-municate-android
q-municate-android copied to clipboard
how can i remove those step like send friendrequest of each other?
how can i do like whats app, without being friend to each other, i am already upload addressbook and retrive alluser but how m'i remove add friend and accept friend step, which function to solve this?
hello anyone there???
Just have a look at related to https://github.com/QuickBlox/q-municate-android/issues/267
i just read this question answer but which property to enable autojoin true like ios. i want to remove those step add and accept friend. i want to direct send message to the registered user. it is possible in quickblox android app or not???
Firstly, you can set autojoin settings in QBChatService to automatically join loaded or created on server dialogs: In that way you don't need to join chat dialog manually in code.
//Set it before login in chat
QBChatService.ConfigurationBuilder builder = new QBChatService.ConfigurationBuilder();
builder.setAutojoinEnabled(true);
QBChatService.setConfigurationBuilder(builder);
Secondly, sure you can send message to the registered user without being friend. You can look at sample-chat.
where can i get QBChatService file?
You can find description of QBChatService class and other useful info in official docs.
when i have open privatedialogActivity before i call this code
QBChatService.ConfigurationBuilder builder = new QBChatService.ConfigurationBuilder(); builder.setAutojoinEnabled(true); QBChatService.setConfigurationBuilder(builder);
after that i have open PrivateDialogActivity in this activity i have seen "You have accepted request"
but i am not able to type any message or audio/video call.
when i was put the code on audio/video call on click put the code there Like
boolean isFriend = DataManager.getInstance().getFriendDataManager().getByUserId(opponentUser.getId()) != null; if (!isFriend && item.getItemId() != android.R.id.home) { ToastUtils.longToast(R.string.dialog_user_is_not_friend); return true; }
i have get opponentUser.getId() this id but i have not find in my user friend list. so how can i add friend bypass accepting friend request like whatsapp. please reply us as soon as possible.
Thanks.
are you there ? Please reply me fast as soon as possible .
If you want use Roster for monitoring user status, you should have a look at #267 branch to autoAcceptIncomingRequests() function. If you don't want use Roster at all, then to be able to type any message just replace in your project:
@Override
protected void checkMessageSendingPossibility() {
// boolean enable = dataManager.getFriendDataManager().existsByUserId(opponentUser.getId()) && isNetworkAvailable();
boolean enable = isNetworkAvailable();
checkMessageSendingPossibility(enable);
}
thanks for the replying. chat option is soved out but when i was click on audio or video call so call the method in ConversationCallFragment like
private void displayOpponentAvatar() { QMUser opponent = ((CallActivity) getActivity()).getOpponentAsUserFromDB(opponents.get(0).getId()); if (StartConversationReason.INCOME_CALL_FOR_ACCEPTION.equals(startConversationReason) && !isVideoCall){ avatarAndNameView.setVisibility(View.VISIBLE); ImageLoader.getInstance().displayImage(opponent.getAvatar(), avatarImageview, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS); callingToTextView.setText(opponent.getFullName()); // calling_to_set_timer.setText(); } else if (StartConversationReason.OUTCOME_CALL_MADE.equals(startConversationReason)) { avatarAndNameView.setVisibility(View.VISIBLE); ImageLoader.getInstance().displayImage(opponent.getAvatar(), avatarImageview, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS); callingToTextView.setText(getString(R.string.calling_to, opponent.getFullName())); // calling_to_set_timer.setText(); } }
so in this method CallActivity.java in calling this function
public QMUser getOpponentAsUserFromDB(int opponentId) { DataManager dataManager = DataManager.getInstance(); Friend friend = dataManager.getFriendDataManager().getByUserId(opponentId); return friend.getUser(); }
return null so my app was crash. so how can i enable this features like same as chat option.
You can try for example the next, replace code:
QMUser opponent = ((CallActivity) getActivity()).getOpponentAsUserFromDB(opponents.get(0).getId());
//with
QMUser opponent = QMUserService.getInstance().getUserCache().get((long)opponents.get(0).getId());
thanks for replying .
IncomingCallFragment.java in this function call so in this function in change any thing. private void setOpponentAvatarAndName(){ QMUser opponent = ((CallActivity) getActivity()).getOpponentAsUserFromDB(sessionDescription.getCallerID()); ImageLoader.getInstance().displayImage(opponent.getAvatar(), avatarImageView, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS); callerName.setText(opponent.getFullName()); }
and also we can implement QBFriendListHelper.java file so that is right or wrong?
private Collection<Integer> createFriendList( Collection<QBRosterEntry> rosterEntryCollection) throws QBResponseException { Collection<Integer> friendList = new ArrayList<>(); Collection<Integer> userList = new ArrayList<>();
for (QBRosterEntry rosterEntry : rosterEntryCollection) {
if (!UserFriendUtils.isOutgoingFriend(rosterEntry) && !UserFriendUtils.isNoneFriend(rosterEntry)) {
friendList.add(rosterEntry.getUserId());
} else if (UserFriendUtils.isNoneFriend(rosterEntry)){
//need remove friend from DB which deleted me when I was offline
friendList.add(rosterEntry.getUserId());
// removeFriendLocal(rosterEntry.getUserId());
}
if (UserFriendUtils.isOutgoingFriend(rosterEntry)) {
userList.add(rosterEntry.getUserId());
}
}
loadAndSaveUsers(userList, UserRequest.RequestStatus.OUTGOING);
return friendList;
}