From db66b085308b8bc7a1ff9440c85895d41c98b5ed Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 27 二月 2021 15:24:44 +0800 Subject: [PATCH] Android推送完善 --- BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java b/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java index 6e77821..3f084a5 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java @@ -30,7 +30,9 @@ 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; @@ -87,6 +89,11 @@ 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); @@ -1245,6 +1252,63 @@ } + /** + * 鎺ㄩ�佺粦瀹歍oken + * + * @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"); @@ -1376,7 +1440,11 @@ 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()) { @@ -1438,6 +1506,11 @@ 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) { -- Gitblit v1.8.0