tencent_im_sdk_plugin 3.9.2 copy "tencent_im_sdk_plugin: ^3.9.2" to clipboard
tencent_im_sdk_plugin: ^3.9.2 copied to clipboard

discontinuedreplaced by: tencent_cloud_chat_sdk
outdated

Instant Messaging (Instant Messaging) is developed based on QQ's underlying IM capabilities. It can easily integrate chat, conversation, group, data management and live barrage capabilities by simply [...]

基本使用用例

  • 初始化
import 'package:tencent_im_sdk_plugin/tencent_im_sdk_plugin.dart';
import 'package:tencent_im_sdk_plugin/models/v2_tim_value_callback.dart';
import 'package:tencent_im_sdk_plugin/enum/log_level.dart';
import 'package:tencent_im_sdk_plugin/manager/v2_tim_manager.dart';
import 'package:tencent_im_sdk_plugin/models/v2_tim_callback.dart';
function initLisener(data){
  String type = data.type;
  switch(type){
      case: 'onConnecting':
      case: 'onConnectSuccess':
      case: 'onConnectFailed':
      case: 'onKickedOffline':
      case: 'onUserSigExpired':
      case: 'onSelfInfoUpdated':
  }
}
//获取腾讯即时通信IM manager;
V2TIMManager timManager = TencentImSDKPlugin.v2TIMManager;
//初始化SDK
V2TimValueCallback<bool> initRes = await timManager.initSDK(
      sdkAppID: sdkAppID,//填入在控制台上申请的sdkappid
      loglevel: LogLevel.V2TIM_LOG_DEBUG,
      listener: initLisener,
);

//V2TimValueCallback 返回的所有数据结构
int code initRes.code;
String desc = initRes.desc;
bool data = initRes.data;//为V2TimValueCallback实例化时接收的泛型。

if(initRes.code == 0){
  //初始化成功
 	//以下监听可按需设置,为防止遗漏消息,请在登录前设置监听。
  //简单监听
  timManager.addSimpleMsgListener(
    listener: simpleMsgListener,
  );
  //群组监听
  timManager.setGroupListener(
    listener: groupListener,
  );
  //高级消息监听
  timManager.getMessageManager().addAdvancedMsgListener(
    listener: advancedMsgListener,
  );
  //关系链监听
  timManager.getFriendshipManager().setFriendListener(
    listener: friendListener,
  );
  //会话监听
  timManager.getConversationManager().setConversationListener(
    listener: conversationListener,
  );
  //设置信令相关监听
  timManager.getSignalingManager().addSignalingListener(
    listener: signalingListener,
  );
 V2TimCallback loginRes await timManager.login(
   userID: userId,
   userSig: userSig,
  );
  //V2TimCallback 返回的所有数据结构
  int code  = loginRes.code;
  String desc = loginRes.desc;
  
  if(code==0){
    //登录成功
    //发送消息
    timManager.sendC2CTextMessage(text:text,userID:userID,)
    //....
    //这里可调用SDK的任何方法。
  }else{
    //登录失败
    print(desc);
  }
}else{
  //初始化失败
}

Managers

29
likes
0
pub points
80%
popularity

Publisher

verified publishercomm.qq.com

Instant Messaging (Instant Messaging) is developed based on QQ's underlying IM capabilities. It can easily integrate chat, conversation, group, data management and live barrage capabilities by simply implanting the SDK. It also supports communication with other products such as whiteboards through signaling messages. , fully cover your business scenarios, support the access and use of small programs on major platforms, and fully meet the communication needs.

Homepage

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, json_annotation, tencent_im_sdk_plugin_platform_interface, tencent_im_sdk_plugin_web, uuid

More

Packages that depend on tencent_im_sdk_plugin