i have an android app that needs to listen for incoming sms messages. i then need to display the senders name associated with the sending telephone number.
my probelm is that the originating address has the country code prefix, where as my contacts does not.
how can i cope with this situation? i was hoping
android.telephony.PhoneNumberUtils
could help but none of its methods seems to be of any use in this case.
surely there must be some android utilities that can convert between numnbers with and without country code prefixes.
for example the smsManager always appears to give me originatingaddress with +44 prefix, whereas some of my personal contacts do not have this prefix attached. am i going to have to code a conversion prcess myself? or use a LIKE predicate when using contentResolver to get my telephone contact display name?
I’m using
PhoneNumberUtils.compare(number1, number2)and it works just fine.http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html#compare(java.lang.String, java.lang.String)