Compose Message "To" field allows adding sequence of characters as contact
When we select this option, this sequence of characters (which is neither a valid email address nor a phone number), gets stored in contact with type MOBILE. Fix: In function canAddToContacts, adding a check to validate whether the contact to be added is a valid email address or phone number. If not, user will not be shown with the option "Add to Contacts".
This commit is contained in:
committed by
Wink Saville
parent
4e9718d6ae
commit
e43a6a02dd
@@ -1263,6 +1263,21 @@ public final class Telephony {
|
||||
return match.matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the number is a Phone number
|
||||
*
|
||||
* @param number the input number to be tested
|
||||
* @return true if number is a Phone number
|
||||
*/
|
||||
public static boolean isPhoneNumber(String number) {
|
||||
if (TextUtils.isEmpty(number)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Matcher match = Regex.PHONE_PATTERN.matcher(number);
|
||||
return match.matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains all MMS messages in the MMS app's inbox.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user