| package com.doumee.keyCabinet.http; | 
|   | 
| import android.os.Build; | 
|   | 
| import java.text.DecimalFormat; | 
| import java.util.HashMap; | 
|   | 
| /** | 
|  * Created by MSI on 2018/5/23. | 
|  */ | 
|   | 
| public class AdvertisingUtils { | 
|     private static final int NETWORK_TYPE_UNAVAILABLE = -1; | 
|     private static final int NETWORK_TYPE_WIFI = -101; | 
|     private static final int NETWORK_CLASS_WIFI = -101; | 
|     private static final int NETWORK_CLASS_UNAVAILABLE = -1; | 
|     /** 不清楚数据流量类型 */ | 
|     private static final int NETWORK_CLASS_UNKNOWN = 0; | 
|     /** 数据流量类型为2G */ | 
|     private static final int NETWORK_CLASS_2_G = 1; | 
|     /**  数据流量类型为3G  */ | 
|     private static final int NETWORK_CLASS_3_G = 2; | 
|     /**  数据流量类型为4G . */ | 
|     private static final int NETWORK_CLASS_4_G = 3; | 
|     private static DecimalFormat df = new DecimalFormat("#.##"); | 
|     // 适配低版本手机 | 
|     /** Network type is unknown */ | 
|     public static final int NETWORK_TYPE_UNKNOWN = 0; | 
|     /** Current network is GPRS */ | 
|     public static final int NETWORK_TYPE_GPRS = 1; | 
|     /** Current network is EDGE */ | 
|     public static final int NETWORK_TYPE_EDGE = 2; | 
|     /** Current network is UMTS */ | 
|     public static final int NETWORK_TYPE_UMTS = 3; | 
|     /** Current network is CDMA: Either IS95A or IS95B */ | 
|     public static final int NETWORK_TYPE_CDMA = 4; | 
|     /** Current network is EVDO revision 0 */ | 
|     public static final int NETWORK_TYPE_EVDO_0 = 5; | 
|     /** Current network is EVDO revision A */ | 
|     public static final int NETWORK_TYPE_EVDO_A = 6; | 
|     /** Current network is 1xRTT */ | 
|     public static final int NETWORK_TYPE_1xRTT = 7; | 
|     /** Current network is HSDPA */ | 
|     public static final int NETWORK_TYPE_HSDPA = 8; | 
|     /** Current network is HSUPA */ | 
|     public static final int NETWORK_TYPE_HSUPA = 9; | 
|     /** Current network is HSPA */ | 
|     public static final int NETWORK_TYPE_HSPA = 10; | 
|     /** Current network is iDen */ | 
|     public static final int NETWORK_TYPE_IDEN = 11; | 
|     /** Current network is EVDO revision B */ | 
|     public static final int NETWORK_TYPE_EVDO_B = 12; | 
|     /** Current network is LTE */ | 
|     public static final int NETWORK_TYPE_LTE = 13; | 
|     /** Current network is eHRPD */ | 
|     public static final int NETWORK_TYPE_EHRPD = 14; | 
|     /** Current network is HSPA+ */ | 
|     public static final int NETWORK_TYPE_HSPAP = 15; | 
|     //是否打开了移动数据流量 | 
|     private static boolean mobileNetwork = false; | 
|     //是否打开了无线 | 
|     private static boolean wifiNetwork= false; | 
|    /* private static AdvertisingUtils utils; | 
|     private Context context; | 
|   | 
|     public static AdvertisingUtils getInstens(){ | 
|         if(utils==null){ | 
|             synchronized (AdvertisingUtils.class){ | 
|                 utils=new AdvertisingUtils(); | 
|             } | 
|         } | 
|         return utils; | 
|     }*/ | 
|   | 
|     public static HashMap<String, Object> getRqHM(int type){ | 
|   | 
|         HashMap<String, Object> hashMap=new HashMap<>(); | 
|         hashMap.put("type",type); | 
|         hashMap.put("os","ANDROID"); | 
|         hashMap.put("osv", Build.VERSION.RELEASE); | 
|         hashMap.put("networktype",1); | 
|         hashMap.put("remoteip", "111"); | 
|         hashMap.put("make", Build.BRAND); | 
|         hashMap.put("brand", Build.BRAND); | 
|         hashMap.put("model", Build.MODEL); | 
|         hashMap.put("deviceType","1"); | 
|         hashMap.put("imei", "121212"); | 
|         hashMap.put("androidid","221212"); | 
|         hashMap.put("width", "100"); | 
|         hashMap.put("height","100"); | 
|         hashMap.put("dpi", 480); | 
|         if(type==2){ | 
|             hashMap.put("orientation", 2); | 
|         }else { | 
|             hashMap.put("orientation", 1); | 
|         } | 
|         hashMap.put("appid", "com.todaycity"); | 
|         hashMap.put("appname", "今日城市"); | 
|         hashMap.put("operator", 1); | 
|         return hashMap; | 
|     } | 
| } |