Reputation:
Samsung Galaxy S6 Edge, Android 6.0.1, Microsoft Exchange Active Sync.
In my app I enumerate all phone numbers for a person. For some people the mobile phone number is listed twice, one with the (manual) formatting I use when I enter the number in Outlook and one with all formatting removed.
Entered and displayed correctly: 010-123 45 67 Also for some people my app gets: 0101234567. This is what is displayed if I send an SMS to that person and Android seems to remember that number and save it invisibly in the address book.
If I look up the person in both Outlook Contacts and on the phone contacts, only the formatted number is visible.
Any clue how to remove the unformatted numbers?
Upvotes: 1
Views: 419
Reputation:
Solved it although I'm sure there is a better way.
phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
String stripped = stripSeparators(phoneNumber);
int count = theNumbers.size();
boolean present = false;
for (int i = 0; i < count; i++)
{
if (stripSeparators(theNumbers.get(i)).equals(stripped) == true)
{
present = true;
break;
}
}
if (present == false)
theNumbers.add(phoneNumber);
Upvotes: 0