-
Notifications
You must be signed in to change notification settings - Fork 2.8k
TUIKit Android快速集成
whalehe edited this page Jun 18, 2019
·
6 revisions
- Android Studio 3.3.2
- Gradle-4.1
TUIKit支持aar集成和module源码、gradle接入三种方式
如果用aar方式集成,这里需要指定libs文件夹下的aar的名称
android {
...
repositories {
flatDir {
dirs 'libs'
}
}
}
然后在添加依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
....
implementation(name: 'tuikit-xxx版本', ext: 'aar')
}
最新aar版本下载:https://github.com/tencentyun/TIMSDK/tree/master/Android/SDK
implementation project(':tuikit')
最新源码下载:https://github.com/tencentyun/TIMSDK/tree/master/Android
dependencies {
...
compile 'com.tencent.imsdk:tuikit:xxx版本'
...
}
最新版本号参考:https://bintray.com/ilive/maven/tuikit 或者 https://github.com/tencentyun/TIMSDK/tree/master/Android/SDK
在Application的onCreate中初始化即可:
public class DemoApplication extends Application {
public static final int SDKAPPID = "您的SDKAppId";
@Override
public void onCreate() {
super.onCreate();
// 配置一些Config,按需配置
TUIKitConfigs configs = TUIKit.getConfigs();
configs.setSdkConfig(new TIMSdkConfig(SDKAPPID));
configs.setCustomFaceConfig(new CustomFaceConfig());
configs.setGeneralConfig(new GeneralConfig());
TUIKit.init(this, SDKAPPID, configs);
}
}
init方法的说明:
/**
* TUIKit的初始化函数
*
* @param context 应用的上下文,一般为对应应用的ApplicationContext
* @param sdkAppID 您在腾讯云注册应用时分配的sdkAppID
* @param configs TUIKit的相关配置项,一般使用默认即可,需特殊配置参考API文档
*/
public static void init(Context context, int sdkAppID, TUIKitConfigs configs)