List of usage examples for android.telecom TelecomManager isVoiceMailNumber
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number)
From source file:com.mobileglobe.android.customdialer.common.compat.telecom.TelecomManagerCompat.java
/** * Return whether a given phone number is the configured voicemail number for a * particular phone account./*from w w w . j a va 2 s . co m*/ * * @param telecomManager the {@link TelecomManager} to use for checking the number. * @param accountHandle The handle for the account to check the voicemail number against * @param number The number to look up. */ public static boolean isVoiceMailNumber(@Nullable TelecomManager telecomManager, @Nullable PhoneAccountHandle accountHandle, @Nullable String number) { if (telecomManager != null && (CompatUtils.isMarshmallowCompatible() || CompatUtils.isMethodAvailable(TELECOM_MANAGER_CLASS, "isVoiceMailNumber", PhoneAccountHandle.class, String.class))) { if (ActivityCompat.checkSelfPermission(DialerApplication.getContext(), Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return false; } return telecomManager.isVoiceMailNumber(accountHandle, number); } return PhoneNumberUtils.isVoiceMailNumber(number); }