Android Question grouping sms by thread

handi trisakti

New Member
Licensed User
Longtime User
I searched & could not find a way to delete SMS by code.
(i tried smsplus, but maybe it doesn't work with android 4.4?)

so, let me try other approach..
is there a way to group SMS into 1 thread based on contents?
ie: group all SMS containing("received speacial offer") into 1 thread
that way i can still delete manually, by opening standard android Messages & delete-thread.

if that's not possible,
maybe create a contact named:"Spam" and add the multiple numbers that sent me the SMS ..?
hopefully, that would group the spam sms together..

thanx..
 

adjie

Member
Licensed User
Longtime User
I'm affraid you have to do it manually by looping the content as the sms information from android not provide it.
Have you try the sms ThreadId ? If the sender is the same, you can get the sms using GetByThreadId and looping them faster instead of using GetAll message.
 
Upvote 0

handi trisakti

New Member
Licensed User
Longtime User
looping them is not a problem..
what I need help with, is how to assign the SMS into a spam thread, so they're all grouped together, and I can simply delete thread, from android standard sms messaging.
--thanx for ur help..


'Declared in GLOBAL
Dim a As SmsMessages

---
Dim list1 As List
Dim str1, id1 As String
list1=a.GetAll()
For i=0 To list1.Size-1
str1=list1.Get(i)
If str1.Contains("received special") Then
** assign this SMS to a spam thread
** so I can open in standard android messages,
** long-click on spam thread and delete all​
End If
Next
 
Upvote 0

handi trisakti

New Member
Licensed User
Longtime User
how about if I try this:
- read all SMS, if it contains spam keywords, write to a file (append) --> spam.txt
- read file spam.txt --> create a contact "SPAM" with all the phone numbers in the file
- maybe all sms will appear grouped under contact SPAM & can easily deleted ..?

i'm only starting to learn b4a, so I don't know how i can convert the above into codes yet..
 
Upvote 0
Top