Block SMS in android

情到浓时终转凉″ 提交于 2019-12-06 05:37:13

The best thing you need to do is debug your code, you have hard coded the phone number in a format that may or may not occur, make sure in what format your receiver phone number appears? When I was working over it I was sending message over 0333xxx-xxxx number and I was receiving as +92xxx. But it's not sure for all, different telecommunication companies may use different format, for that you should use

if(number.equals("+92333xxx-xxxxx")) or better use a contains, that would actually make it more appropriate to match the number and remove the possibility of format error

if(number.contains("333xxx-xxxxx")){
    // Your code to abort message
}

Hope this helps

Equals used for comparing the object only. try to use if(senderNum.equalsIngnorecase("+923215619915")) or if(senderNum.indexOf("+923215619915") != -1).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!