> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-angular-v5-docs-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrading From V1

> Upgrading From V1 — CometChat documentation.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-angular-v5-docs-update/35nHswVgWvBftvIw/images/1b7c3fdd-UAAAAYdEVYdGV4aWY6UGl4ZWxZRGltZW5zaW9uADIxN14Eu6AAAAAASUVORK5CYII.png?fit=max&auto=format&n=35nHswVgWvBftvIw&q=85&s=dc86af375d7fb1ff8a0db549a87c9bf6" width="644" height="217" data-path="images/1b7c3fdd-UAAAAYdEVYdGV4aWY6UGl4ZWxZRGltZW5zaW9uADIxN14Eu6AAAAAASUVORK5CYII.png" />
</Frame>

Upgrading from v1.x to v2 is fairly simple. Below are the major changes that are released as a part of CometChat Pro v2.

## Initialization

The `CometChat.init()` method now takes an additional parameter. This parameter is an object of the `AppSettings` class. This object can be created by using the `AppSettingsBuilder` class. The `AppSettings` class provides CometChat with the below 2 details:

1. Region: The region of your app
2. [Presence Subscription](/sdk/android/2.0/user-presence)

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // v1.x

    CometChat.init(this, appID, new CometChat.CallbackListener<String>() {
      @Override
      public void onSuccess(String successMessage) {
        Log.d(TAG, "Initialization completed successfully");
      }
      @Override
      public void onError(CometChatException e) {
        Log.d(TAG, "Initialization failed with exception: " + e.getMessage());
      }
    });


    // v2.0

    AppSettings appSettings=new AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion("eu").build();

    CometChat.init(this, appID,appSettings, new CometChat.CallbackListener<String>() {
      @Override
      public void onSuccess(String successMessage) {
        Log.d(TAG, "Initialization completed successfully");
      }
      @Override
      public void onError(CometChatException e) {
        Log.d(TAG, "Initialization failed with exception: " + e.getMessage());
      }
    });
    ```
  </Tab>
</Tabs>

## Text Message Constructor

Since the only possible valid value the `messageType` parameter could take in the constructor was `CometChatConstants.MESSAGE_TYPE_TEXT`, we have removed the `messageType` parameter from the `TextMessage` constructor.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // v1.x

    TextMessage textMessage = new TextMessage(receiverID, messageText, messageType, receiverType);


    // v2.0

    TextMessage textMessage = new TextMessage(receiverID, messageText, receiverType);
    ```
  </Tab>
</Tabs>

## Mark a Message as Read

In v1.x, for marking the messages as read, every message had to marked as read individually using the `CometChat.markMessageAsRead()` which took the entire message object as the input parameter.

Starting v2.0, the method name has been changed to `markAsRead()` which takes the `messageId `,`receiverId`, and `receiverType` as input. This method, will mark all the messages as read. For more information, please check the [mark messages as read](/sdk/android/2.0/delivery-read-receipts#mark-messages-as-read) guide.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // v1.x

    CometChat.markMessageAsRead(message);

    // v2.0

    CometChat.markAsRead(messageId, receiverId, receiverType);
    ```
  </Tab>
</Tabs>

## Retrieve List of Friends

In v1.x to fetch only friends, you had to enable the Show only friends setting in the CometChat Dashboard.

Starting v2.x, we have added a method in the UsersRequestBuilder to fetch only friends. This method accepts `boolean` and fetches only friends if it is set to `true` else it fetches all the users. By default it is set to `false`. For more information, please check the [retrieve list of users](/sdk/android/2.0/retrieve-users#retrieve-list-of-users) guide.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    //v2.x

    UsersRequest usersRequest = new UsersRequest.UsersRequestBuilder()
    .setLimit(limit)
    .friendsOnly(true)
    .build();
    ```
  </Tab>
</Tabs>
