龙图安卓SDK 渠道论坛功能接入说明

1.文档说明

1.1 功能描述

此文档主要是用于在游戏及应用开发商需要仅接入渠道论坛功能时,了解渠道论坛功能如何接入,接入过程中需注意的事项等。
游戏需要在使用前判断当前渠道是否支持论坛功能,如果支持才可以继续使用。

2 检测当前渠道是否支持论坛功能【必接】

2.1 功能说明

不同渠道支持的功能不同,所以有一些渠道不支持论坛功能。
需要在使用前先判断当前渠道是否支持论坛功能。
返回值为true时为支持
返回值为false时为不支持

2.2 接口定义

  1. /**
  2. * 论坛功能是否可用
  3. *
  4. * @return true 可用, false不可用
  5. */
  6. public boolean LTBaseChannels_isForumPageEnable()

2.3 接口示例

  1. // 论坛功能是否可用
  2. LTBaseSDK.getInstance(this).LTBaseChannels_isForumPageEnable();

3 初始化渠道论坛【必接】

3.1 功能说明

渠道论坛初始化功能,初始化成功以后才可以使用论坛功能。
回调说明请参照: (7 论坛功能回调说明【必接】)

3.2 接口定义

  1. /**
  2. * 初始化渠道论坛
  3. *
  4. * @param orientation 论坛打开时,横屏还是竖屏
  5. * @param listener 论坛相关回调
  6. */
  7. public void LTBaseChannels_initForumPage(final int orientation, final LTBaseForumPageListener listener)

orientation说明

参数 参数描述
横屏 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
竖屏 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

3.3 接口示例

  1. // 初始化论坛功能,竖屏论坛示例
  2. LTBaseSDK.getInstance(LTBase_Demo_ForumPage.this).LTBaseChannels_initForumPage(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mLTBaseForumPageListener);

3.4 回调示例

  1. private LTBaseForumPageListener mLTBaseForumPageListener = new LTBaseForumPageListener() {
  2. @Override
  3. public void onForumPageInit(boolean isSuccess, int code, String msg) {
  4. if (isSuccess == true) {
  5. Toast.makeText(LTBase_Demo_ForumPage.this, "论坛初始化成功", Toast.LENGTH_SHORT).show();
  6. } else {
  7. Toast.makeText(LTBase_Demo_ForumPage.this, "论坛初始化失败 code:" + code + "msg:" + msg, Toast.LENGTH_SHORT).show();
  8. }
  9. }
  10. @Override
  11. public void onOpenForumPageSuccess(int code, String msg) {
  12. Toast.makeText(LTBase_Demo_ForumPage.this,
  13. "打开论坛成功 code:" + code + " msg:" + msg,
  14. Toast.LENGTH_SHORT).show();
  15. }
  16. @Override
  17. public void onOpenForumPageFailure(int code, String msg) {
  18. Toast.makeText(LTBase_Demo_ForumPage.this,
  19. "打开论坛失败 code:" + code + " msg:" + msg,
  20. Toast.LENGTH_SHORT).show();
  21. }
  22. @Override
  23. public void onCheckSceneSuccess(String sceneId, int status) {
  24. Toast.makeText(LTBase_Demo_ForumPage.this,
  25. "检测论坛入口成功 sceneId:" + sceneId + " status:" + status,
  26. Toast.LENGTH_SHORT).show();
  27. }
  28. @Override
  29. public void onCheckSceneFailure(String sceneId, int code, String msg) {
  30. Toast.makeText(LTBase_Demo_ForumPage.this,
  31. "检测论坛入口失败 sceneId:" + sceneId + " code:" + code + " msg:" + msg,
  32. Toast.LENGTH_SHORT).show();
  33. }
  34. };

4 打开论坛【必接】

4.1 功能说明

打开渠道论坛

4.2 接口定义

  1. /**
  2. * 打开论坛,当前接口只能打开渠道论坛,暂时只有华为渠道支持
  3. */
  4. public void LTBaseChannels_openForumPage()

4.3 接口示例

  1. // 打开论坛功能
  2. LTBaseSDK.getInstance(this).LTBaseChannels_openForumPage();

5 检查场景id是否有效【选接】

5.1 功能说明

用于打开指定帖子的时候,先检查帖子id是否有效,是否可以打开。
场景id(帖子id) 由运营在华为后台配置生成。

5.2 接口定义

  1. /**
  2. * 检查 场景id是否有效,
  3. * 如果无效,则需要屏蔽相关入口
  4. */
  5. public void LTBaseChannels_checkScene(final String sceneId)

5.3 接口示例

  1. // 打开论坛功能
  2. LTBaseSDK.getInstance(this).LTBaseChannels_checkScene("场景id");

6 打开指定场景【选接】

6.1 功能说明

打开指定场景论坛

6.2 接口定义

  1. /**
  2. * 进入指定场景 场景id是否有效
  3. */
  4. public void LTBaseChannels_openScene(final String sceneId)

6.3 接口示例

  1. // 打开论坛功能
  2. LTBaseSDK.getInstance(this).LTBaseChannels_openScene("场景id");

7 论坛功能回调说明【必接】

7.1 功能说明

论坛相关回调接口,包含初始化是否成功,打开论坛是否成功。

7.2 接口定义

7.2.1 论坛初始化回调

  1. /**
  2. * 论坛初始化
  3. *
  4. * @param isSuccess 是否初始化成功 true 成功 false 失败
  5. * @param code 错误码
  6. * @param msg 错误描述
  7. */
  8. void onForumPageInit(boolean isSuccess, int code, String msg);

7.2.2 论坛打开成功回调

  1. /**
  2. * 论坛打开成功
  3. *
  4. * @param code 错误码
  5. * @param msg 错误描述
  6. */
  7. void onOpenForumPageSuccess(int code, String msg);

7.2.3 论坛打开失败回调

  1. /**
  2. * 论坛打开成功
  3. *
  4. * @param code 错误码
  5. * @param msg 错误描述
  6. */
  7. void onOpenForumPageFailure(int code, String msg);

7.2.4 检查入口成功回调

  1. /**
  2. * 检查入口成功
  3. *
  4. * @param sceneId 场景信息id
  5. * @param status 场景状态 是否为有效入口ID:
  6. 0:无效入口ID。
  7. 1:有效入口ID。
  8. */
  9. void onCheckSceneSuccess(String sceneId, int status);

7.2.5 检查入口失败回调

  1. /**
  2. * 检查入口失败
  3. *
  4. * @param sceneId 场景信息id
  5. * @param code 错误码
  6. * @param msg 错误描述
  7. */
  8. void onCheckSceneFailure(String sceneId, int code, String msg);