Hi all,
I am having trouble working out how to handle phone numbers. I am getting both call and inbound sms notifications and note that the different processes deliver differently formatted numbers. For example SMS MessageReceived delivers an international formatted number +44754xxxx and the PhoneStateChanged event has an incoming number without the country code 0754xxx.
I have to match these numbers against a list of numbers that is made up of different strings +44 754xx, or +44754xxx, 0044754xxxx, +44 (0) 754xx.
I can go strip out all the spaces and dashed and brackets etc to help normalise the lookup data but I am just wondering if I can do something about the source number.
Is there a call I can make to have a number converted to the international format?
I have seen the PhoneNumberUtils function formatNumber
http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html
Will this help me convert the 0754xxx number to the +44754xx number?
I am not experienced enough to know how to use PhoneNumberUtils in Basic4Andriod so I can't try it.
Any suggestions are welcomed.
Thanks
dave
I am having trouble working out how to handle phone numbers. I am getting both call and inbound sms notifications and note that the different processes deliver differently formatted numbers. For example SMS MessageReceived delivers an international formatted number +44754xxxx and the PhoneStateChanged event has an incoming number without the country code 0754xxx.
I have to match these numbers against a list of numbers that is made up of different strings +44 754xx, or +44754xxx, 0044754xxxx, +44 (0) 754xx.
I can go strip out all the spaces and dashed and brackets etc to help normalise the lookup data but I am just wondering if I can do something about the source number.
Is there a call I can make to have a number converted to the international format?
I have seen the PhoneNumberUtils function formatNumber
http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html
Will this help me convert the 0754xxx number to the +44754xx number?
I am not experienced enough to know how to use PhoneNumberUtils in Basic4Andriod so I can't try it.
Any suggestions are welcomed.
Thanks
dave