I am working on an application which requires that the user enters his phone number on registration, and that number should present on same device. Is there any way find it?
I've already checked with the TelephonyManager
but it doesn't guarantee that always get the number:
private void getMobileNumber() {
TelephonyManager tMgr = (TelephonyManager)
mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();
}
I've already checked with the SubscriptionManager
too, and it doesn't guarantee either:
private void GetCarriorsInformation() {
ArrayList<string Numbers = new ArrayList<>();
SubscriptionManager mSubscriptionManager = SubscriptionManager.from(context);
List<SubscriptionInfo> subInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
if (subInfoList.size() > 1) {
isMultiSimEnabled = true;
}
for (SubscriptionInfo subscriptionInfo : subInfoList) {
Numbers.add(subscriptionInfo.getNumber());
}
}
Is there any other way to validate if the phone number is present on same device or not?