安卓对接文档

安卓对接文档


上传角色、区服信息

<h1>上传角色、区服信息</h1> <p>接口调用场景 (<strong>以下场景必须调用,其它场景按需调用</strong>):</p> <pre><code>1. 创建角色 2. 角色进入服务器 3. 角色升级 4. 加入帮派、变更帮派、退出帮派 5. 使用改名卡</code></pre> <h2>接口定义</h2> <pre><code>public void uploadRoleInfo(Context context, String[] infos, final NetCallBack netCallBack)</code></pre> <h2>接口参数说明</h2> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>是否必须</th> <th>参数说明</th> </tr> </thead> <tbody> <tr> <td>app_id</td> <td>String</td> <td>是</td> <td>必须游戏接入时分配的应用app_id</td> </tr> <tr> <td>mem_id</td> <td>String</td> <td>是</td> <td>登陆时提供给CP的用户id</td> </tr> <tr> <td>server</td> <td>String</td> <td>是</td> <td>游戏区服名称</td> </tr> <tr> <td>server_id</td> <td>String</td> <td>是</td> <td>游戏区服id</td> </tr> <tr> <td>role</td> <td>String</td> <td>是</td> <td>角色名称</td> </tr> <tr> <td>role_id</td> <td>String</td> <td>是</td> <td>角色id</td> </tr> <tr> <td>guild</td> <td>String</td> <td>是</td> <td>公会or帮派 默认传空(null,''),或传无</td> </tr> <tr> <td>lever</td> <td>String</td> <td>是</td> <td>等级</td> </tr> <tr> <td>country</td> <td>String</td> <td>是</td> <td>国家</td> </tr> <tr> <td>power</td> <td>String</td> <td>是</td> <td>战力</td> </tr> <tr> <td>server_id_merge</td> <td>String</td> <td>是</td> <td>合服后区服id</td> </tr> <tr> <td>sign</td> <td>String</td> <td>是</td> <td>必须的参数校验</td> </tr> </tbody> </table> <h2>接口回调说明</h2> <p>无</p> <h2>调用完整代码</h2> <pre><code>String app_id = &amp;quot;60024&amp;quot;; String mem_id = &amp;quot;20&amp;quot;; String server = &amp;quot;广东一区&amp;quot;; String role = &amp;quot;张三&amp;quot;; String guild = &amp;quot;联盟&amp;quot;; String lever = &amp;quot;999&amp;quot;; String server_id = &amp;quot;1&amp;quot;; String role_id = &amp;quot;2&amp;quot;; String country = &amp;quot;国家&amp;quot;; String power = &amp;quot;战力&amp;quot;; String server_id_merge = &amp;quot;2&amp;quot;; String sign = md5(&amp;quot;app_id=&amp;quot;+app_id+&amp;quot;&amp;amp;mem_id=&amp;quot;+mem_id +&amp;quot;&amp;amp;server=&amp;quot;+server+&amp;quot;&amp;amp;server_id=&amp;quot;+server_id +&amp;quot;&amp;amp;role=&amp;quot;+role+&amp;quot;&amp;amp;role_id=&amp;quot;+role_id +&amp;quot;&amp;amp;guild=&amp;quot;+guild+&amp;quot;&amp;amp;lever=&amp;quot;+lever +&amp;quot;&amp;amp;country=&amp;quot;+country+&amp;quot;&amp;amp;power=&amp;quot;+power +&amp;quot;&amp;amp;server_id_merge=&amp;quot;+server_id_merge); String[] infos = {app_id,mem_id,server,server_id,role,role_id,guild,lever,country,power,server_id_merge,sign}; sdkManager.uploadRoleInfo(MainActivity.this, infos, new NetCallBack() { @Override public void onInitSuccess(ResultCode result) { //数据提交成功 Toast.makeText(MainActivity.this,&amp;quot;onInitSuccess&amp;quot;,Toast.LENGTH_LONG).show(); } @Override public void onInitFail(ResultCode result) { //数据提交失败 Toast.makeText(MainActivity.this,&amp;quot;onInitFail&amp;quot;,Toast.LENGTH_LONG).show(); } }); /** 计算字符串MD5值* */ public static String md5(String string) { if (TextUtils.isEmpty(string)) { return &amp;quot;&amp;quot;; } MessageDigest md5 = null; try { md5 = MessageDigest.getInstance(&amp;quot;MD5&amp;quot;); byte[] bytes = md5.digest(string.getBytes()); String result = &amp;quot;&amp;quot;; for (byte b : bytes) { String temp = Integer.toHexString(b &amp;amp; 0xff); if (temp.length() == 1) { temp = &amp;quot;0&amp;quot; + temp; } result += temp; } return result; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return &amp;quot;&amp;quot;; }</code></pre>

页面列表

ITEM_HTML