I am currently working on SmsReceiver service, which checks address of SMS sender and if the number matches one in my database, I can process the message.
But the thing is, phone numbers given by getOriginatingAddress() method are always with country code, currently +420 so getOriginatingAddress() returns for example +420123456789. (CZ)
Parsing isn't a problem, but what I don't know is, where does the country code comes from? Is it from TelephonyManager getSimCountryIso() or is it taken from current country I am in, or where sender is from?
I could possibly grab first two/three numbers then look for them them in some predefined map of country codes, but I would like to do this with 100% correct information given by the phone rather then me "guessing".
The getOriginatingAddress
gets the full number (including the country code) from the Sms itself.
Each sms contains the information of the recipient, the sender, and the body of the sms (and much more).
The device/provider that sent you the sms places their full number (e164 format) including country code in to the Sms packet, and sends it to you, your device makes no guesses about the country code.