接口獲取下來(lái)的數(shù)據(jù)為
{"status":200,"message":"查詢成功","data":{"id":32,"user_id":null,"user_code":null,"user_pass":null,"meeting_id":"1","meeting_pass":null,"config_param_ip":"11.1.1.70","port":"6501","web_config_param_ip":"11.1.1.70","web_port":"6501","unit_code":null,"create_time":null,"update_time":null,"status":0,"userCode":"video1","userPass":"video1","meetingId":"1","meetingPass":"","apiPort":"13000","username":"admin","password":"123456","updateTime":"2021-11-08 17:45:29"}}
使用方法
try {
? ? JSONObject jsonObject = new JSONObject(outstring);
? ? int resultCode = jsonObject.getInt("status");
? ? if (resultCode == 200) {
? ? ? ? JSONObject obj = jsonObject.getJSONObject("data");
? ? ? ? IP = obj.getString("config_param_ip");
? ? ? ? port = obj.getString("web_port");
? ? ? ? username = obj.getString("userCode");
? ? ? ? password = obj.getString("userPass");
? ? ? ? roomID = Integer.parseInt(obj.getString("meetingId"));
? ? ? ? roomPassword = obj.getString("password");
? ? } else {
? ? ? ? ToastUtils.showShort("查詢失敗");
? ? }
? ? goVideo();
} catch (Exception e) {
? ? e.printStackTrace();
}