Android Example SMS Incoming & Reply Separation

Discussion in 'Tutorials & Examples' started by Joy Garcia, Mar 13, 2015.

  1. Joy Garcia

    Joy Garcia Member Licensed User

    Good Day!

    I've test this code to retrieve sms message, from my samsung, and it works.

    ' ------------------------------------------------------
    Sub Process_Globals
    Dim sms_idkey As Long
    Dim threadid_dat As Long
    Dim datelog_dat As String
    Dim readsms_dat As Boolean
    Dim bodysms_dat As String
    Dim addresscp_dat As String
    End Sub

    Sub GetSMS_Click
    Dim SmsMessages1 As SmsMessages
    Dim List1 As List

    List1 = SmsMessages1.GetAll()
    For i = 0 To List1.Size - 1
    Dim Sms As Sms

    Sms = List1.Get(i)

    Log(Sms.Id & " - " & Sms.Address & " - " & Sms.Body)

    sms_idkey=Sms.Id
    threadid_dat=Sms.ThreadId
    datelog_dat=DateUtils.TicksToString(Sms.Date)
    readsms_dat=Sms.Read
    bodysms_dat=Sms.Body
    addresscp_dat=Sms.Address

    Next
    End Sub

    ' -----------------------------------------------------------

    I just want to ask if how to use the SMS features to separate the Incoming SMS and Reply SMS, upon retrieving messages in the phone, since the above code will retrieving all sms message mixed, whether reply or sent from the sender.


    Jhoey
     
    koaunglay likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Sms.Type will return the type of message. This can be one of the SmsMessages constants (TYPE_UNKNOWN, TYPE_INBOX, TYPE_SENT, ...).
     
    koaunglay likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice