briankabiro/react-native-get-sms-android

How to filter SMS messages by sender

Closed this issue · 4 comments

I am asking how to filter all messages sent by paytm. Paytm have senders VM-IPAYTM, AXiPaytm, HPvpaytm, etc.. like that. I need to filter paytm messages but cant filter by senders because it will change in future by AM-paytm,VXpaytm,CPpaytm like that. is there any option in this package for this help me..
ex. sms-listener-paackage
let subscription = SmsListener.addListener(message => {
let sender =message.originatingAddress
if(sender.includes("paytm")){
this.setState({
messageBody : message.body,
});
subscription.remove();
}
})
here it shows all messages received by paytm. like that i am asking

Switched to proper title.

Please don't just tag people, that's like walking into a room of people working when you have a question, and tapping 4 people you don't know on the shoulder. It is very insistent. I understand you have a need but think of others needs.

I closed your previous issue because it lacked details. This still lacks details, specifically I asked what your SMS JSON looked like and I don't see it here.

What does the SMS JSON of a message you would like to match look like? Have you tried using Javascript to check if parts of the SMS JSON that you want to match contain the things you want to match? It may be that you just need to fetch all the SMS, and filter for the thing you need to match. It appears you already have code that does this that pasted above. Does it not work for some reason?

The docs indicate no other filter support, so this would be the way I would go about it.

I don't mean to be rude, but I feel as though you are asking me to code your solution for you, without trying things. This package retrieves SMS for you, what you do with it is up to you. If there is a problem retrieving messages, or if the filters that we support do not work, then raise an issue with specific steps to reproduce

this is my json
{
"sms_list": [
{
"sms": "hi ",
"date": "20190310"
},
{
"sms": "hello",
"date": "20190311"
},
{
"sms": "how are you.",
"date": "20190312"
},
{
"sms": "is anyone there",
"date": "20190312"
},
{
"sms": "i have doubt",
"date": "20190312"
},
{
"sms": "thanks for your patience",
"date": "20190312"
},
{
"sms": its helpful.",
"date": "20190312"
},
{
"sms": "nice solution",
"date": "20190312"
}
}

I am getting this. but I need to give an address like VM-IPAYTM. I need to give simply paytm in the address and it will filter all messages for paytm this is my need.. is it possible.? In the filter, 7 objects are there, that's why I am asking. @mikehardy #

You haven't actually printed out all the SMS attributes available. And I believe the from is just going to be a number. Either way, please read the docs and code and try the example and experiment

https://github.com/briankabiro/react-native-get-sms-android/blob/master/android/src/main/java/com/react/SmsModule.java

https://stackoverflow.com/questions/4022088/how-many-database-columns-associated-with-a-sms-in-android

https://developer.android.com/reference/android/provider/Telephony.TextBasedSmsColumns.html

If the current code is not behaving the way you like please log an issue relative the example with exact steps to reproduce,

I won't respond to further questions unless it is clear you have put in a great deal more effort in the attempt