One-to-one chats

One-to-one chats refer to private chats between two users. You can start a one-to-one chat with another user through their user profile. To find other users registered with the Delivered SDK please refer to the instructions in the Contacts section.

You can start a conversation from within a user’s profile by tapping on the button at the bottom right corner of the screen:

start_one_to_one_profile.png

This action will automatically start a chat with that user and send an invite to them. You may start writing messages already, although the other user won’t be able to see them until they accept your invite.

Managing chat invites

When a user starts a one-to-one chat, the other party will receive an invite which they must accept in order to join the conversation. To display received invites you can use the InvitesListFragment component provided by the Delivered SDK. To add the InvitesListFragment to your application follow this sample snippet:

public class InvitesActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contacts);
        
        ...
        
        InvitesListFragment invitesFragment = new InvitesListFragment();
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

        fragmentTransaction.add(R.id.contact_fragment_container, invitesFragment);
        fragmentTransaction.commit();
        
        ...

    }
	...
}

Initially the invite list will appear empty:

request_screen_empty.png

When received, chat invites will automatically appear in the list:

requests_screen_full.png

By tapping on the “accept” button (represented by a tick symbol) the request will be accepted. On the other hand, tapping on the “reject” button (represented by a cross) will reject the request and remove it from the list.

Accepting an invite will automatically open a conversation. For this to happen you must first provide a conversation Activity. If you have not done it already, refer to the Initial setup section for instructions on how achieve this:

one_to_one_conv.png

Once you have started a chat with someone else, or accepted an invite, it is time to display them in a chat list. Head up to the Displaying chats section for instructions on how to do this.