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

discontinuedreplaced by: tencent_cloud_chat_sdk
outdated

Instant Messaging (Instant Messaging) is developed based on QQ's underlying IM capabilities.

Basic use case

Online api test tool (scan code to download)

img

Api call use case

GitHub address

  • Initialization
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':
  }
}
// Get Tencent instant messaging IM manager;
V2TIMManager timManager = TencentImSDKPlugin.v2TIMManager;
// Initialize SDK
V2TimValueCallback<bool> initRes = await timManager.initSDK(
      sdkAppID: sdkAppID,// Fill in the sdkappid applied on the console
      loglevel: LogLevel.V2TIM_LOG_DEBUG,
      listener: initLisener,
);

// All data structures returned by V2TimValueCallback
int code initRes.code;
String desc = initRes.desc;
bool data = initRes.data;// Generic type received when instantiating for V2TimValueCallback.

if(initRes.code == 0){
  // Initialization successful
  // The following monitoring can be set as needed. To prevent missing messages, please set monitoring before logging in.
  // simple monitor
  timManager.addSimpleMsgListener(
    listener: simpleMsgListener,
  );
 // Various monitoring can be added here, such as session monitoring, message receiving monitoring, group monitoring, etc.
 V2TimCallback loginRes await timManager.login(
   userID: userId,
   userSig: userSig,
  );
  // All data structures returned by V2TimCallback
  int code  = loginRes.code;
  String desc = loginRes.desc;
  
  if(code==0){
    // login successful
    // send messages
    timManager.sendC2CTextMessage(text:text,userID:userID,)
    //....
    // Any method of the SDK can be called here.
  }else{
    // Login failed
    print(desc);
  }
}else{
  // initialization failed
}

Managers

  • V2TIMManager

    The group advanced interface includes advanced functions of the group, such as group member invitation, non-group member application to join the group and other operation interfaces.

  • V2TIMFriendshipManager

    The relationship chain interface includes logic for adding and deleting friends, and adding and deleting blacklists.

  • V2TIMGroupManager

    The group advanced interface includes advanced functions of the group, such as group member invitation, non-group member application to join the group and other operation interfaces.

  • V2TIMConversationManager

    The session interface contains the logic for acquiring, deleting and updating sessions.

  • V2TIMMessageManager

    Provides advanced message processing related interfaces

  • V2TIMOfflinePushManager

    Provide offline push related interface

  • V2TIMSignalingManager

    Provides interfaces related to signaling operations

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.

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