doum
6 天以前 2b287056e2f59518888d05a1bbc7e5a55fbd84d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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;
    }
}