im::floo::floolib::BMXClient

客户端

Inherits from im.floo.floolib.BMXNetworkListener

Public Functions

Name
synchronized void delete()
BMXSDKConfig getSDKConfig()
获取SDK设置
BMXUserService getUserService()
获取用户Service
BMXChatService getChatService()
获取聊天Service
BMXGroupService getGroupService()
获取群组Service
BMXRosterService getRosterService()
获取好友Service
BMXPushService getPushService()
获取推送Service
BMXUserManager getUserManager()
获取用户Manager
BMXChatManager getChatManager()
获取聊天Manager
BMXGroupManager getGroupManager()
获取群组Manager
BMXRosterManager getRosterManager()
获取好友Manager
BMXPushManager getPushManager()
获取推送Manager
[BMXErrorCode] signUpNewUser(String username, String password, BMXUserProfile bmxUserProfilePtr)
注册新用户,username和password是必填参数
[BMXErrorCode] signInByName(String name, String password)
通过用户名登录
[BMXErrorCode] signInById(long arg0, String password)
通过用户ID登录
[BMXErrorCode] fastSignInByName(String name, String password)
通过用户名快速登录(要求之前成功登录过,登录速度较快)
[BMXErrorCode] fastSignInById(long uid, String password)
通过用户ID快速登录(要求之前成功登录过,登录速度较快)
[BMXErrorCode] signOut(long uid, boolean ignoreUnbindDevice)
退出登录
[BMXErrorCode] signOut(long uid)
[BMXErrorCode] signOut()
[BMXConnectStatus] connectStatus()
获取当前和服务器的连接状态
[BMXSignInStatus] signInStatus()
获取当前的登录状态
void reconnect()
强制重新连接
void onNetworkChanged([BMXNetworkType] type, boolean reconnect)
处理网络状态发送变化
void disconnect()
断开网络连接
[BMXErrorCode] changeAppId(String appId, String appSecret)
更改SDK的appId,本操作会同时更新BMXConfig中的appId。
[BMXErrorCode] changeAppId(String appId)
更改SDK的appId,本操作会同时更新BMXConfig中的appId。
[BMXErrorCode] initializeServerConfig(boolean isLocal)
获取app的服务器网络配置,在初始化SDK之后登陆之前调用,可以提前获取服务器配置加快登陆速度。
void sendMessage(BMXMessage msg)
发送消息,消息状态变化会通过listener通知,在发送群组消息且指定的群组为开启群组已读回执的情况下, 该接口会自动获取群成员列表id并且填充到message config中去,无需客户端自己进行群组成员列表的填充操作。
BMXClient create(BMXSDKConfig config)
创建BMXClient

Protected Functions

Name
BMXClient(long cPtr, boolean cMemoryOwn)
void finalize()
long getCPtr(BMXClient obj)

Additional inherited members

Public Functions inherited from im.floo.floolib.BMXNetworkListener

Name
void swigReleaseOwnership()
void swigTakeOwnership()
BMXNetworkListener()

Protected Functions inherited from im.floo.floolib.BMXNetworkListener

Name
BMXNetworkListener(long cPtr, boolean cMemoryOwn)
void swigDirectorDisconnect()

Public Functions Documentation

function delete

inline synchronized void delete()

Reimplements: im::floo::floolib::BMXNetworkListener::delete

Example:

function getSDKConfig

inline BMXSDKConfig getSDKConfig()

获取SDK设置

Return: BMXSDKConfigPtr

Example:

public static void changeDNS(String server, int port, String restServer) {
    if (bmxClient == null || bmxClient.getSDKConfig() == null) {
        return;
    }
    BMXSDKConfig conf  = bmxClient.getSDKConfig();
    if (!TextUtils.isEmpty(server) && port > 0 && !TextUtils.isEmpty(restServer)) {
        // 三项数据都不为空才设置
        BMXSDKConfig.HostConfig hostConfig = conf.getHostConfig();
        hostConfig.setImHost(server);
        hostConfig.setImPort(port);
        hostConfig.setRestHost(restServer);
        conf.setHostConfig(hostConfig);
        conf.setEnableDNS(false);
    } else {
        conf.setEnableDNS(true);
    }
    bmxClient = BMXClient.create(conf);
public static void changeDNS(String server, int port, String restServer) {
    if (bmxClient == null || bmxClient.getSDKConfig() == null) {
        return;
    }
    BMXSDKConfig conf  = bmxClient.getSDKConfig();
    if (!TextUtils.isEmpty(server) && port > 0 && !TextUtils.isEmpty(restServer)) {
        // 三项数据都不为空才设置
        BMXSDKConfig.HostConfig hostConfig = conf.getHostConfig();
        hostConfig.setImHost(server);
        hostConfig.setImPort(port);
        hostConfig.setRestHost(restServer);
        conf.setHostConfig(hostConfig);
        conf.setEnableDNS(false);
    } else {
        conf.setEnableDNS(true);
    }
    bmxClient = BMXClient.create(conf);
@Override
protected void initDataForActivity() {
    // 获取app版本
    String versionName = BuildConfig.VERSION_NAME;
    mAppVersion.setText("Lanying IM Version:" + versionName);
    BMXClient client = BaseManager.getBMXClient();
    String sdkVersion = "";
    if (client != null && client.getSDKConfig() != null
            && !TextUtils.isEmpty(client.getSDKConfig().getSDKVersion())) {
        sdkVersion = client.getSDKConfig().getSDKVersion();
    }
    mFlooVersion.setText("FlooSDK Version:" + sdkVersion);
@Override
protected void initDataForActivity() {
    // 获取app版本
    String versionName = BuildConfig.VERSION_NAME;
    mAppVersion.setText("Lanying IM Version:" + versionName);
    BMXClient client = BaseManager.getBMXClient();
    String sdkVersion = "";
    if (client != null && client.getSDKConfig() != null
            && !TextUtils.isEmpty(client.getSDKConfig().getSDKVersion())) {
        sdkVersion = client.getSDKConfig().getSDKVersion();
    }
    mFlooVersion.setText("FlooSDK Version:" + sdkVersion);
@Override
protected void initDataForActivity() {
    // 获取app版本
    String versionName = BuildConfig.VERSION_NAME;
    mAppVersion.setText("Lanying IM Version:" + versionName);
    BMXClient client = BaseManager.getBMXClient();
    String sdkVersion = "";
    if (client != null && client.getSDKConfig() != null
            && !TextUtils.isEmpty(client.getSDKConfig().getSDKVersion())) {
        sdkVersion = client.getSDKConfig().getSDKVersion();
    }
    mFlooVersion.setText("FlooSDK Version:" + sdkVersion);

function getUserService

inline BMXUserService getUserService()

获取用户Service

Return: BMXUserService

Example:

function getChatService

inline BMXChatService getChatService()

获取聊天Service

Return: BMXChatService

Example:

function getGroupService

inline BMXGroupService getGroupService()

获取群组Service

Return: BMXGroupService

Example:

function getRosterService

inline BMXRosterService getRosterService()

获取好友Service

Return: BMXRosterService

Example:

function getPushService

inline BMXPushService getPushService()

获取推送Service

Return: BMXPushService

Example:

function getUserManager

inline BMXUserManager getUserManager()

获取用户Manager

Return: BMXUserManager

Example:

function getChatManager

inline BMXChatManager getChatManager()

获取聊天Manager

Return: BMXChatManager

Example:

function getGroupManager

inline BMXGroupManager getGroupManager()

获取群组Manager

Return: BMXGroupManager

Example:

function getRosterManager

inline BMXRosterManager getRosterManager()

获取好友Manager

Return: BMXRosterManager

Example:

function getPushManager

inline BMXPushManager getPushManager()

获取推送Manager

Return: BMXPushManager

Example:

function signUpNewUser

inline BMXErrorCode signUpNewUser(
    String username,
    String password,
    BMXUserProfile bmxUserProfilePtr
)

注册新用户,username和password是必填参数

Parameters:

  • username 用户名
  • password 用户密码
  • bmxUserProfilePtr 注册成功后从该函数处获取新注册用户的Profile信息,初始传入指向为空的shared_ptr对象即可。

Return: [BMXErrorCode]

Example:

function signInByName

inline BMXErrorCode signInByName(
    String name,
    String password
)

通过用户名登录

Parameters:

  • name 用户名
  • password 用户密码

Return: [BMXErrorCode]

Example:

function signInById

inline BMXErrorCode signInById(
    long arg0,
    String password
)

通过用户ID登录

Parameters:

  • arg0 用户id
  • password 用户密码

Return: [BMXErrorCode]

Example:

function fastSignInByName

inline BMXErrorCode fastSignInByName(
    String name,
    String password
)

通过用户名快速登录(要求之前成功登录过,登录速度较快)

Parameters:

  • name 用户名
  • password 用户密码(用于sdk在内部token到期时自动更新用户token)

Return: [BMXErrorCode]

Example:

function fastSignInById

inline BMXErrorCode fastSignInById(
    long uid,
    String password
)

通过用户ID快速登录(要求之前成功登录过,登录速度较快)

Parameters:

  • uid 用户id
  • password 用户密码(用于sdk在内部token到期时自动更新用户token)

Return: [BMXErrorCode]

Example:

function signOut

inline BMXErrorCode signOut(
    long uid,
    boolean ignoreUnbindDevice
)

退出登录

Parameters:

  • uid 退出用户的uid(默认输入0则退出当前登陆用户)
  • ignoreUnbindDevice 用户退出时是否忽略解绑定设备操作。对应某些服务器不可访问的情况下忽略服务器解绑定设备操作直接强制退出时设置为true

Return: [BMXErrorCode]

Example:

function signOut

inline BMXErrorCode signOut(
    long uid
)

Example:

function signOut

inline BMXErrorCode signOut()

Example:

function connectStatus

inline BMXConnectStatus connectStatus()

获取当前和服务器的连接状态

Return: [BMXConnectStatus]

Example:

function signInStatus

inline BMXSignInStatus signInStatus()

获取当前的登录状态

Return: [BMXSignInStatus]

Example:

function reconnect

inline void reconnect()

强制重新连接

Example:

function onNetworkChanged

inline void onNetworkChanged(
    BMXNetworkType type,
    boolean reconnect
)

处理网络状态发送变化

Parameters:

  • type 变化后的网络类型
  • reconnect 网络是否需要重连

Reimplements: im::floo::floolib::BMXNetworkListener::onNetworkChanged

Example:

function disconnect

inline void disconnect()

断开网络连接

Example:

function changeAppId

inline BMXErrorCode changeAppId(
    String appId,
    String appSecret
)

更改SDK的appId,本操作会同时更新BMXConfig中的appId。

Parameters:

  • appId 新变更的appId
  • appSecret 新变更的appSecret

Example:

function changeAppId

inline BMXErrorCode changeAppId(
    String appId
)

更改SDK的appId,本操作会同时更新BMXConfig中的appId。

Parameters:

  • appId 新变更的appId

Example:

function initializeServerConfig

inline BMXErrorCode initializeServerConfig(
    boolean isLocal
)

获取app的服务器网络配置,在初始化SDK之后登陆之前调用,可以提前获取服务器配置加快登陆速度。

Parameters:

  • isLocal 为true则使用本地缓存的dns配置,为false则从服务器获取最新的配置。

Example:

function sendMessage

inline void sendMessage(
    BMXMessage msg
)

发送消息,消息状态变化会通过listener通知,在发送群组消息且指定的群组为开启群组已读回执的情况下, 该接口会自动获取群成员列表id并且填充到message config中去,无需客户端自己进行群组成员列表的填充操作。

Parameters:

  • msg 发送的消息

Example:

function create

static inline BMXClient create(
    BMXSDKConfig config
)

创建BMXClient

Parameters:

  • config 客户端本地已经创建好的BMXSDKConfig SDK配置对象

Return: BMXClientPtr

Protected Functions Documentation

Example:

    public static void initBMXSDK() {
        String appPath = getFilesPath(AppContextUtils.getAppContext());
        File dataPath = new File(appPath + "/data_dir");
        File cachePath = new File(appPath + "/cache_dir");
        dataPath.mkdirs();
        cachePath.mkdirs();

        String pushId = getPushId();
        BMXSDKConfig conf = new BMXSDKConfig(BMXClientType.Android, "1", dataPath.getAbsolutePath(),
                cachePath.getAbsolutePath(), TextUtils.isEmpty(pushId) ? "MaxIM" : pushId);
        conf.setAppID(SharePreferenceUtils.getInstance().getAppId());
//        conf.setAppSecret(ScanConfigs.CODE_SECRET);
        conf.setConsoleOutput(true);
        conf.setLoadAllServerConversations(true);
        conf.setLogLevel(BMXLogLevel.Debug);
        conf.setDeviceUuid(RomUtil.getDeviceId());
        conf.setEnvironmentType(BMXPushEnvironmentType.Production);
        conf.setPushProviderType(getProvideType(AppContextUtils.getAppContext()));
        bmxClient = BMXClient.create(conf);
public static void changeDNS(String server, int port, String restServer) {
    if (bmxClient == null || bmxClient.getSDKConfig() == null) {
        return;
    }
    BMXSDKConfig conf  = bmxClient.getSDKConfig();
    if (!TextUtils.isEmpty(server) && port > 0 && !TextUtils.isEmpty(restServer)) {
        // 三项数据都不为空才设置
        BMXSDKConfig.HostConfig hostConfig = conf.getHostConfig();
        hostConfig.setImHost(server);
        hostConfig.setImPort(port);
        hostConfig.setRestHost(restServer);
        conf.setHostConfig(hostConfig);
        conf.setEnableDNS(false);
    } else {
        conf.setEnableDNS(true);
    }
    bmxClient = BMXClient.create(conf);

function BMXClient

inline BMXClient(
    long cPtr,
    boolean cMemoryOwn
)

Example:

function finalize

inline void finalize()

Reimplements: im::floo::floolib::BMXNetworkListener::finalize

Example:

function getCPtr

static inline long getCPtr(
    BMXClient obj
)

Example:


Updated on 2022-01-26 at 17:18:31 +0800

© 2019-2022 美信拓扑 | 官网 该文件修订时间: 2022-09-21 11:43:07

results matching ""

    No results matching ""