tencent cloud

Feedback

Last updated: 2022-06-01 19:22:46

    This document describes how to quickly run the IM demo for Flutter.

    Environment Requirements

    Platform Version
    Flutter 2.2.0 or later
    Android Android Studio 3.5 or later; devices with Android 4.1 or later for apps
    iOS Xcode 11.0 or later. Ensure that your project has a valid developer signature.

    Prerequisites

    You have signed up for a Tencent Cloud account and completed identity verification.

    Directions

    Step 1. Create an app

    1. Log in to the IM console.
      Note:

      If you already have an app, record its SDKAppID and obtain key information.
      A Tencent Cloud account can create a maximum of 300 IM apps. If you want to create a new app, disable and delete an unwanted app first. Once an app (along with its SDKAppID) is deleted, the provided service and all its data are lost. Please proceed with caution.

    2. Click Create Application, enter your app name, and click Confirm.
    3. After creation, you can see the status, service version, SDKAppID, creation time, and expiry time of the new app on the overview page of the console. Record the SDKAppID.
    4. Click the created app. In the left sidebar, click Auxiliary Tools > UserSig Tools to create a UserID and the corresponding UserSig. Then copy the UserSig for future login.

    Step 2. Download the SDK and source code

    1. Download the SDK and demo source code that fit your needs.
    2. Then, go to the directory TIMSDK/Flutter/Demo/im_discuss.
    3. Run Flutter pub get to install the dependencies, launch the demo project, and enter the following command:
      flutter run --dart-define=SDK_APPID=xxxx --dart-define=ISPRODUCT_ENV=false --dart-define=KEY=xxxx
    Note:

    • Replace xxxx in --dart-define=SDK_APPID=xxxx with the SDKAppID created in Step 1.
    • Use --dart-define=ISPRODUCT_ENV=false to determine the environment (development or production). Enter “false” for a development environment.
    • Replace xxxx in --dart-define=KEY=xxxx with the key mentioned in Step 1.
    1. Configure the launch.json file in the Visual Studio.

    Step 3 (optional). Run and debug the project in the IDE

    1. Go to the discuss/andorid directory via Android Studio.
    2. Start an Android simulator, tap Build And Run to run the demo. Enter a random UserID (a combination of digits and letters).

    >? The UI of the latest version of the demo may look different after adjustments.

    FAQs

    What platforms are supported?

    Currently, iOS, Android, and web platforms are supported. In addition, the editions for Windows and macOS are under development. Please stay tuned.

    What should I do if clicking Build And Run for an Android device triggers an error, stating no available device is found?

    Check that the device is not occupied by other resources. Alternatively, click Build to generate an APK package, drag it to the simulator, and run it.

    What should I do if an error occurs during the first run for an iOS device?

    If an error is reported for an iOS device after the demo configured as above is run, choose Product > Clean to clean the product, and build the demo again. You can also close Xcode and open it again, and then build the demo again.

    Flutter environment

    If you want to check the Flutter environment, run Flutter doctor to detect whether the Flutter environment is ready.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support