From 658b2cffec9b1610753166a41b7df56ea8dcc989 Mon Sep 17 00:00:00 2001 From: wangkun555 <625917592@qq.com> Date: Tue, 1 Mar 2016 11:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0sdk=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新sdk文档 --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d73dbd3..81e3b5fc 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,34 @@ SDK 提供的可选信息有:添加用户信息和用户自定义字段 + 文本类型:首先我们也要获得”field_name”字段的字段的值作为key值,然后将"comment"字段的值作为value值存入即可; 代码如下: -![udesk](/indeximg/andriod-new-10.png) +UdeskHttpFacade.getInstance().getUserFields(UDESK_DOMAIN,UDESK_SECRETKEY, new UdeskCallBack() { + + @Override + public void onSuccess(String result) { + try { + JSONObject jo = new JSONObject(result); + int status = jo.optInt("status"); + if (status == 0) { + JSONArray jsonArray = jo.getJSONArray("user_fields"); + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject child = (JSONObject) jsonArray.get(i); + if (child.has("content_type")) { + String type = child.getString("content_type"); + if (type.equals("droplist")) { + if (child.has("options")) { + // 想设置下拉列表的第几个值,则传入第几个key值字符串, 如下所示 + extraInfodRoplist.put( + child.getString("field_name"), + "0"); + } + } else if (type.equals("text")) { + extraInfoTextField.put( + child.getString("field_name"), + child.getString("comment")); + } + } + } + } 可选字段信息如下: @@ -357,11 +384,11 @@ public void initApiKey(Context context,String domain, String secretKey){ ### 机器人api public void showRobot(final Context context) { + if(!TextUtils.isEmpty(getH5Url(context))){ toLanuchRobotAcitivty(context,getH5Url(context), getTransfer(context)); return; } - showLoading(context); UdeskHttpFacade.getInstance().getRobotJsonApi(getDomain(context),getSecretKey(context),new UdeskCallBack() {