tencent_im_sdk_plugin 3.9.3 tencent_im_sdk_plugin: ^3.9.3 copied to clipboard
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 [...]
Basic use case
Online api test tool (scan code to download)
Api call use case
- 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
-
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.
-
The relationship chain interface includes logic for adding and deleting friends, and adding and deleting blacklists.
-
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.
-
The session interface contains the logic for acquiring, deleting and updating sessions.
-
Provides advanced message processing related interfaces
-
Provide offline push related interface
-
Provides interfaces related to signaling operations