初始化
接口
kotlin
fun init(context: Context, appId: String, config: BimImConfig)
fun getInstance(): BimImManager
fun getAppId(): String
fun release()
fun getSdkVersion(): Stringinit 应在 Application 或其他稳定生命周期中调用。重复使用相同配置初始化会复用当前 SDK runtime;释放后需要重新初始化。
代码示例
kotlin
val config = BimImConfig.Builder()
.setBaseUrl("https://example.com")
.setImEndpoint("example.com:8029")
.setLogLevel(BimLogLevel.INFO)
.setCallbackExecutor(Executors.newSingleThreadExecutor())
.build()
BimImManager.getInstance().init(applicationContext, "your-app-id", config)
BimImManager.getInstance().baseCoreService.addSdkListener(sdkListener)INTERNET 权限由宿主在 Manifest 中声明。release() 只关闭 SDK runtime 和连接,不删除本地消息、会话或同步数据。
