|
@@ -22,6 +22,7 @@ import androidx.core.app.ActivityCompat;
|
22
|
22
|
|
23
|
23
|
import java.io.File;
|
24
|
24
|
import java.lang.reflect.Method;
|
|
25
|
+import java.util.ArrayList;
|
25
|
26
|
import java.util.List;
|
26
|
27
|
import java.util.Locale;
|
27
|
28
|
|
|
@@ -236,6 +237,32 @@ public class SystemUtil {
|
236
|
237
|
return iccid;
|
237
|
238
|
}
|
238
|
239
|
|
|
240
|
+ public static ArrayList<String> getPhoneNumber(Context context) {
|
|
241
|
+ ArrayList<String> numList = new ArrayList<String>();
|
|
242
|
+ try {
|
|
243
|
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
|
|
244
|
+ SubscriptionManager sm = SubscriptionManager.from(context);
|
|
245
|
+ List<SubscriptionInfo> sis = sm.getActiveSubscriptionInfoList();
|
|
246
|
+ if (sis.size() >= 1) {
|
|
247
|
+ SubscriptionInfo si1 = sis.get(0);
|
|
248
|
+ String phoneNum1 = si1.getNumber();
|
|
249
|
+ numList.add(phoneNum1);
|
|
250
|
+ }
|
|
251
|
+ if (sis.size() >= 2) {
|
|
252
|
+ SubscriptionInfo si2 = sis.get(1);
|
|
253
|
+ String phoneNum2 = si2.getNumber();
|
|
254
|
+ numList.add(phoneNum2);
|
|
255
|
+ }
|
|
256
|
+ // 获取SIM卡数量相关信息:
|
|
257
|
+ int count = sm.getActiveSubscriptionInfoCount();//当前实际插卡数量
|
|
258
|
+ int max = sm.getActiveSubscriptionInfoCountMax();//当前卡槽数量
|
|
259
|
+ }
|
|
260
|
+ } catch (Exception e) {
|
|
261
|
+ LogUtils.d("获得手机信息", "问题是" + e.toString());
|
|
262
|
+ }
|
|
263
|
+ return numList;
|
|
264
|
+ }
|
|
265
|
+
|
239
|
266
|
public static String getWifiMac(Context context) {
|
240
|
267
|
String wifiMac = "";
|
241
|
268
|
try {
|