version:1.2.4
fix: update:优化显示未读短信和未接来电,增加手电筒和数据开关
This commit is contained in:
@@ -324,19 +324,19 @@ public class Utils {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isMultiSim(Context context){
|
||||
public static boolean isMultiSim(Context context) {
|
||||
boolean result = false;
|
||||
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
||||
if(telecomManager != null){
|
||||
if (telecomManager != null) {
|
||||
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
|
||||
result = phoneAccountHandleList.size() >= 2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void call(Context context, int id, String telNum){
|
||||
public static void call(Context context, int id, String telNum) {
|
||||
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
||||
if(telecomManager != null){
|
||||
if (telecomManager != null) {
|
||||
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_CALL);
|
||||
@@ -346,4 +346,24 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
public static String getIMEI(Context context, int slotIndex) {
|
||||
String imei;
|
||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
imei = tm.getImei(slotIndex);
|
||||
} else {
|
||||
imei = tm.getDeviceId(slotIndex);
|
||||
}
|
||||
if (TextUtils.isEmpty(imei)) {
|
||||
return "暂无数据";
|
||||
}
|
||||
return imei;
|
||||
}
|
||||
|
||||
public static String getEmid(Context context) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
String meid = telephonyManager.getDeviceId();
|
||||
return meid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user