更新日期:2023-01-04咪咕快游云游戏渠道额外接口说明
一. 如何获取渠道云广告数据
1. 先判断是否支持接口,调用 isFunctionSupported(funcType), 其中 funcType == 10086
2. 在接口支持判断返回为 true 的情况下调用 callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callback, Object... arg3) 请求广告数据
实例代码如下:
if (Extend.getInstance().isFunctionSupported(10086)) { Extend.getInstance().callFunctionWithParamsCallBack(mActivity, 10086, new BaseCallBack() { @Override public void onSuccess(Object... objects) { //请求广告数据成功 AdvertReplyBean advertReplyBean = (AdvertReplyBean)objects[0]; Log.d("请求广告数据成功", ""); } @Override public void onFailed(Object... objects) { //失败信息 String message = (String)objects[0]; Log.d("请求渠道广告失败", "失败信息是:" +message); } }); }
二. 如何判断运行环境(云上/本地环境)
调用方式跟上面接口一样,只是 funcType的值变为了208602
if(Extend.getInstance().isFunctionSupported(208602)) { Extend.getInstance().callFunctionWithParamsCallBack(mActivity, 208602, new BaseCallBack() { @Override public void onSuccess(Object... objects) { String resultJson = (String)objects[0]; try { JSONObject resultObject = new JSONObject(resultJson); boolean isRunningLocal = resultObject.getBoolean("isRunningLocal"); Log.d("调用拓展方法成功", "isRunningLocal = " +i sRunningLocal); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onFailed(Object... objects) { Log.d("调用拓展方法失败", ""); } }); }
三. 游戏数据上报
游戏按如下接口进行调用,new JSONObject().toString()即为上传的数据,QuickSDK会原样传给渠道
int funcType = 2086006; if (Extend.getInstance().isFunctionSupported(funcType)){ Extend.getInstance().callFunctionWithParamsCallBack(MainActivity.this, funcType, new BaseCallBack() { @Override public void onSuccess(Object... objects) { //成功回调 } @Override public void onFailed(Object... objects) { //失败回调 } }, new JSONObject().toString()); }
四、成就接口 (成就接口返回的数据均为渠道数据类型ToString后的字符串)
1. 查询用户所有平台设置过的成就 funcType为 2086001
public void callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callBack, Object... infos) {}
该接口调用渠道的(void queryAllAchievement(SearchPersonlAchevementCallBack callback)接口,然后会通过BaseCallBack的回调返回数据
onSuccess回调的objects[0]一个String型的数据(achievementPersonalBean.toString()后的字符串)
示例:
int funcType = 2086001; if (Extend.getInstance().isFunctionSupported(funcType)){ Extend.getInstance().callFunctionWithParamsCallBack(this, funcType, new BaseCallBack() { @Override public void onSuccess(Object... objects) { Log.d(TAG, "onSuccess: "+objects[0].toString()); } @Override public void onFailed(Object... objects) { Log.d(TAG, "onFailed: "+objects[0].toString()); } }); }
2. 查询用户单个成就状态 funcType为 2086002
public void callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callBack, Object... infos) {}
该接口调用渠道的(void queryAchievement(String achievementId, SearchAchievementCallBack callback))接口,然后会通过BaseCallBack的回调返回数据
onSuccess回调的objects[0]一个String型的数据(achievementBean.toString())
示例:
int funcType2 = 2086002; if (Extend.getInstance().isFunctionSupported(funcType)){ String achievementId = "132132"; //待查询成就 id Extend.getInstance().callFunctionWithParamsCallBack(this, funcType2, new BaseCallBack() { @Override public void onSuccess(Object... objects) { Log.d(TAG, "funcType2 onSuccess: "+objects[0].toString()); } @Override public void onFailed(Object... objects) { Log.d(TAG, "funcType2 onFailed: "+objects[0].toString()); } },achievementId); }
3. 批量设置用户成就 funcType为 2086003
public void callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callBack, Object... infos) {}
该接口调用渠道的(void setAchievementBatch(List
注意,接口的第四个参数infos传 AchievementSetBean类型的数组
该接口的回调未返回数据
4. 设置用户单个成就 funcType为 2086004
public void callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callBack, Object... infos) {}
该接口调用渠道的(void setAchievement(String achievementId, int type, double reach_value,SetAchievementCallBack callback))接口
注意,接口的第四个参数infos 依次传入String achievementId(成就 id) int type(成就类型) double reachValue(达成成就数值)
该接口的回调未返回数据
5. 查询单个成就达成率 funcType为 2086005
public void callFunctionWithParamsCallBack(Activity activity, int funcType, BaseCallBack callBack, Object... infos) {}
该接口调用渠道的(void queryAchievementPercentage(String achievementId,SearchAchievementPercentageCallBack callBack))接口
注意,接口的第四个参数infos传 String achievementId(成就 id)
该接口会通过BaseCallBack的回调返回数据。
onSuccess回调的objects[0]一个String型的数据(achievementPercentageBean.toString())
李先生:13880511661
QQ:48157910
赵先生:15390049857
QQ:1077535763
孙女士:13551010407
QQ:1799614139
QQ群:698731538