查询公会id和成员openid关系
查询公会id和成员openid关系
通过调用Tencent类的 checkJoinGroup调用解绑群接口
API格式:
checkJoinGroup(Context context, Bundle params, IUiListener listener)
参数1 Context: 上下文
参数2 Bundle:外部传递参数
参数 | 是否必填 | 类型 | 参数说明 |
---|---|---|---|
GameAppOperation.GAME_UNION_ID | 是 | String | 公会ID |
GameAppOperation.GAME_ZONE_ID | 是 | String | 游戏区域ID |
参数3 IUiListener 回调实例。
返回码 0: 成功
221002: 未绑定群
221005: 当前用户不是群主
调用接口的示例代码如下:
mTencent = Tencent.createInstance(APPID, this); Bundle params = new Bundle(); params.putString(GameAppOperation.GAME_GUILD_ID, guild_id.getText()); params.putString(GameAppOperation.GAME_GUILD_ZONE_ID , zone_id.getText()); IUiListener listener = new IUiListener() { @Override public void onComplete(Object response) { Util.toastMessage(this, “onComplete:” + response.toString()); JSONObject jsonObject = (JSONObject )response; try{ String retMsg = (String)jsonObject.getString(“retMsg”); int retCode = (Integer)jsonObject.getInt(“retCode”); int relation = (Integer)jsonObject.getInt(“relation”); //todo 根据返回码 和 群关系进行处理 }catch (JSONException e) { e.printStackTrace(); } } @Override public void onCancel() { Util.toastMessage(this, “onCancel ” ); } @Override public void onError(UiError e) { Util.toastMessage(this, “onError:” + e.errorMessage, “e”); } } mTencent.checkJoinGroup(this, params,listener);
注意:CGI调用需要登录态!!!