| | |
| | | import com.loopj.android.http.RequestParams; |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.ut.device.UTDevice; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | |
| | | import org.json.JSONArray; |
| | | |
| | |
| | | params.put("Lat", lat); |
| | | params.put("Lng", lng); |
| | | params.put("Channel", channel); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (!StringUtils.isBlank(BeibeiVideoApplication.deviceNumber)) { |
| | | params.put("DeviceName", BeibeiVideoApplication.deviceName); |
| | | params.put("DeviceNumber", BeibeiVideoApplication.deviceNumber); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送绑定Token |
| | | * |
| | | * @param context |
| | | * @param type |
| | | * @param token |
| | | * @param handler |
| | | */ |
| | | public static void pushBindToken(Context context, String type, String token, |
| | | ResponseHandlerInterface handler, boolean async) { |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (loginUid != null) |
| | | |
| | | if (type != null) |
| | | params.put("type", type); |
| | | |
| | | if (token != null) |
| | | params.put("regId", token); |
| | | |
| | | String model = android.os.Build.MODEL; |
| | | if (model != null) |
| | | params.put("model", model); |
| | | |
| | | String version = android.os.Build.VERSION.RELEASE; |
| | | if (version != null) { |
| | | params.put("androidVersion", version); |
| | | } |
| | | |
| | | |
| | | commonPost(context, BASE_URL + "push/bindDeviceToken", params, null, handler, async, false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上传PPTV播放记录 |
| | | * |
| | | * @param context |
| | | * @param cid |
| | | * @param vid |
| | | * @param handler |
| | | */ |
| | | public static void uploadPPTVPlayRecord(Context context, String cid, String vid, |
| | | ResponseHandlerInterface handler) { |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | String uid = UserUtil.getUid(context); |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (loginUid != null) |
| | | params.put("loginUid", loginUid); |
| | | if (uid != null) |
| | | params.put("Uid", uid); |
| | | params.put("Cid", cid); |
| | | params.put("Vid", vid); |
| | | commonPost(context, BASE_URL + "video/play/pptvPlay", params, handler); |
| | | } |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | | params.put("System", "1"); |
| | |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | FormBody.Builder builder = new FormBody.Builder(); |
| | | for (String key : map.keySet()) { |
| | |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |