Background
It is possible to check if a given string represents a valid phone number, using this code, together with the PhoneNumberUtil library by Google (available here) :
public static boolean isValidNumber(final PhoneNumber phone) {
if (phone == null)
return false;
final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
return phoneNumberUtil.isValidNumber(phone);
}
public static boolean isValidPhoneNumber(String phone) {
if (TextUtils.isEmpty(phone))
return false;
phone = phone.replaceAll("[^0-9]", "");
final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
PhoneNumber phoneNumber = null;
try {
phoneNumber = phoneNumberUtil.parse(phone, Locale.getDefault().getCountry());
} catch (final Exception e) {
}
return isValidNumber(phoneNumber);
}
The problem
This is only a general check, but I can't find out if it's possible to know if the phone number is actually of a mobile device.
What I've tried
As I've read in some websites, the above check might need to have just a small adjustment to know if it's of a mobile device, but according to my tests, it's wrong :
...
phone = phone.replaceAll("[^0-9]", "");
if (phone.length() < 7)
return false;
...
The question
Is it possible to know if the phone number is of a mobile device?
If so, how ?