简体   繁体   中英

How to filter incoming sms message number

I made an app , which automatically responds to calls and text messages. my problem is that i dont want to send the auto reply if the incoming number is from the mobile network provider. I only want to send the auto reply if the message is from a normal number. I was thinking of doing this (psuedo code below)

if (incomingNumber != +3538{
      sendMessage();
      }

the +353 is the country code of Ireland and all normal mobile numbers start with 08 but when the country code (+353) is used the 0 before the 8 is dropped. If i was to do it this way I would have to add every country code in the world then. I was just thinking was their a better way.

The solution I came up with was:

if (phoneNumber.contains("+")){
    //Code Here
    }

I think that all normal numbers start with "+" (ie +3538.......) and only service numbers don't start with this ie(50135)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM