Import TUIKit (Android)

Last updated: 2020-07-01 14:46:21

    Development Environment Requirements

    • Android Studio 3.6.1
    • Gradle-5.1.1

    Integration Description

    TUIKit can be integrated through gradle, aar, or module source code.

    Gradle integration

    dependencies {
        ...
         implementation 'com.tencent.imsdk:tuikit:xxx version'
        ...
    }

    Replace the xxx in xxx version with the latest aar version number.

    Module source code integration

    implementation project(':tuikit')

    aar integration

    1. Specify the name of the aar under the libs folder.

      android {
       ...
       repositories {
           flatDir {
               dirs 'libs'
           }
       }
      }
    2. Add dependencies.

      dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar'])
       ....
       implementation(name: 'tuikit-xxx version', ext: 'aar')
      }

      Replace the xxx in tuikit-xxx version with the latest aar version number.

    Initialization

    Initialize in onCreate for the app:

    public class DemoApplication extends Application {
    
        public static final int SDKAPPID = 0; // Your SDKAppID
    
        @Override
        public void onCreate() {
            super.onCreate();
    
           // Set Config according to your needs
           TUIKitConfigs configs = TUIKit.getConfigs();
           configs.setSdkConfig(new V2TIMSDKConfig());
           configs.setCustomFaceConfig(new CustomFaceConfig());
           configs.setGeneralConfig(new GeneralConfig());
    
           TUIKit.init(this, SDKAPPID, configs);
        }
    }

    Description of the init method:

    /**
     * TUIKit initialization function
     *
     * @param context  App context, which is usually the ApplicationContext of the app
     * @param sdkAppID SDKAppID that is assigned to you when registering the app in Tencent Cloud
     * @param configs TUIKit configuration items. Use default settings for these configuration items in most cases. For special configuration, see API Documentation.
     */
    public static void init(Context context, int sdkAppID, TUIKitConfigs configs)
    

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help