# Preparations

Let's look at the required libraries and project structure to run the app.

# Project folder structure

Project (excluding files other than the app folder)
├─build.gradle
├─libs
│  ├─android-support-v4.jar
│  └─BGAPhotoPicker.aar
├─src.test.java.com.vchatcloud.androidsample.ExampleUnitTest.java
├─src.androidTest.java.com.vchatcloud.androidsample.ExampleInstrumentedTest.java
└─src.main
   ├─AndroidManifest.xml
   ├─ic_launcher-playstore.png
   ├─res
   │  ├─color
   │  ├─drawable
   │  ├─drawable-v24
   │  ├─layout
   │  ├─mipmap-anydpi-v26
   │  ├─mipmap-hdpi
   │  ├─mipmap-mdpi
   │  ├─mipmap-xhdpi
   │  ├─mipmap-xxhdpi
   │  ├─mipmap-xxxhdpi
   │  ├─values
   │  └─xml
   └─java.com.vchatcloud.androidsample
      ├─adapter
      │   ├─ChatListAdapter.java
      │   ├─EmojiAdapter.java
      │   └─HorizontalListView.java
      ├─fragment
      │   └─EmojiFragment.java
      ├─photoView
      │   ├─HackyViewPager.java
      │   └─ViewPagerActivity.java
      ├─resourse
      │   ├─Constant.java
      │   ├─EmojiRescourse.java
      │   └─ProfileRescource.java
      ├─viewpagerindicator
      │   ├─CirclePageIndicator.java
      │   └─PageIndicator.java
      ├─BackKeyHandler.java
      ├─ChatActivity.java
      ├─ImageEdit.java
      ├─LoadingActivity.java
      ├─MainActivity.java
      ├─Message.java
      ├─PreferenceManager.java
      └─ProgressRequestBody.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

# Required changes

If you download the sample code, be sure to change the 'channelKey' value. You can check the part to be changed through the explanation below and change it. For folder structure, refer to [project folder structure] (#Project-Folder-Structure).

    # vchatcloud object

    # vchatcloud class

    A VChatCloud instance can be called as a singleton.

    VChatCloud.getInstance()
    
    1

    # channel method declaration

    channel is a method implemented on the vchatCloud instance. You can use the channel method to enter a chat room and control message events. The code below deals only with entering the chat room, and for detailed event descriptions such as sending messages and notifications, please refer to 'Message' in the left menu list.

    ChannelOptions options = new ChannelOptions();
    options.setChannelKey(room_id);
    options.setClientKey(deviceUuid);
    options.setNickName(nick_name);
    options.setUserInfo(userInfo);
    Channel channel = VChatCloud.getInstance().joinChannel(options, new JoinChannelCallback() {
        public void callback(JSONArray history, VChatCloudException e) {
            super.callback(history, e);
            int historySize = history.size() -1;
            for (; historySize >= 0; historySize--) {
                Log.d("History", "" + history.get(historySize) );
            }
            Log.d("History", "Room start");
        }
    });
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    • Parameter values ​​(options)

      value identifier Description
      ChannelKey String Channel Key issued after creating a chat room
      ClientKey String Unique key for access terminal setting
      NickName String Nickname of the user entering the chat room
      UserInfo String User profile information
    • result value

      -error

      value identifier Description
      code String error code
      type String error type
      message String error message

      -history

      value identifier Description
      logType String log type
      roomId String Channel Key issued after creating a chat room
      clientKey String Unique key for access terminal setting
      message String message contents
      mimeType String message type (text: plain text, emoji: emoji)
      messageType String In case of empty value, general message, notice: "notice"
      nickName String Nickname of the user entering the chat room
      date String Transit time
      grade String User Rating

    # write code

    Actual app as code for operation It consists of entry to the chat room / chat / whisper / public notice / expulsion / restriction on writing. Please note that you will be directed to a login pop-up where you enter the chat room number and alias upon entering. Below are the java code parts that control each event.

      Copyright 2022. E7Works Inc. & JOYTUNE Corp. All Rights Reserved.