|
34 | 34 | import java.security.MessageDigest; |
35 | 35 | import java.text.DecimalFormat; |
36 | 36 | import java.text.SimpleDateFormat; |
| 37 | +import java.util.ArrayList; |
37 | 38 | import java.util.HashMap; |
| 39 | +import java.util.List; |
38 | 40 | import java.util.Locale; |
39 | 41 | import java.util.Map; |
40 | 42 | import java.util.Random; |
@@ -147,6 +149,66 @@ public static String getMEID(TelephonyManager telephonyManager, int index) { |
147 | 149 | return Reflection.getMeid(telephonyManager, index); |
148 | 150 | } |
149 | 151 |
|
| 152 | + public static String getTelephonyId(TelephonyManager telephonyManager, int index) { |
| 153 | + return Reflection.getTelephonyId(telephonyManager, index); |
| 154 | + } |
| 155 | + |
| 156 | + public static String getTelephonyIds(TelephonyManager telephonyManager) { |
| 157 | + List<String> telephonyIds = new ArrayList<String>(); |
| 158 | + |
| 159 | + String telephonyId0 = getTelephonyId(telephonyManager, 0); |
| 160 | + if (telephonyId0 != null) { |
| 161 | + telephonyIds.add(telephonyId0); |
| 162 | + } |
| 163 | + |
| 164 | + for (int i = 1; i < 10; i++) { |
| 165 | + String telephonyId = getTelephonyId(telephonyManager, i); |
| 166 | + if (telephonyId == null) { |
| 167 | + break; |
| 168 | + } |
| 169 | + telephonyIds.add(telephonyId); |
| 170 | + } |
| 171 | + |
| 172 | + return TextUtils.join(",", telephonyIds); |
| 173 | + } |
| 174 | + |
| 175 | + public static String getIMEIs(TelephonyManager telephonyManager) { |
| 176 | + List<String> imeis = new ArrayList<String>(); |
| 177 | + |
| 178 | + String imei0 = getIMEI(telephonyManager, 0); |
| 179 | + if (imei0!= null) { |
| 180 | + imeis.add(imei0); |
| 181 | + } |
| 182 | + |
| 183 | + for (int i = 1; i < 10; i++) { |
| 184 | + String imei = getIMEI(telephonyManager, i); |
| 185 | + if (imei == null) { |
| 186 | + break; |
| 187 | + } |
| 188 | + imeis.add(imei); |
| 189 | + } |
| 190 | + |
| 191 | + return TextUtils.join(",", imeis); |
| 192 | + } |
| 193 | + |
| 194 | + public static String getMEIDs(TelephonyManager telephonyManager) { |
| 195 | + List<String> meids = new ArrayList<String>(); |
| 196 | + |
| 197 | + String meid0 = getMEID(telephonyManager, 0); |
| 198 | + if (meid0 != null) { |
| 199 | + meids.add(meid0); |
| 200 | + } |
| 201 | + |
| 202 | + for (int i = 1; i < 10; i++) { |
| 203 | + String meid = getMEID(telephonyManager, i); |
| 204 | + if (meid == null) { |
| 205 | + break; |
| 206 | + } |
| 207 | + meids.add(meid); |
| 208 | + } |
| 209 | + |
| 210 | + return TextUtils.join(",", meids); |
| 211 | + } |
150 | 212 |
|
151 | 213 | public static <T> T readObject(Context context, String filename, String objectName, Class<T> type) { |
152 | 214 | Closeable closable = null; |
|
0 commit comments