Android Question Getting the Date and Time of SMS

Discussion in 'Android Questions' started by Joy Garcia, Aug 26, 2018.

  1. Joy Garcia

    Joy Garcia Member Licensed User

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
        Type Message (Address As String, Body As String, Time as Long)' -------i added here Time as Long
    End Sub

    Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.Action = "android.provider.Telephony.SMS_RECEIVED" Then
    Dim messages() As Message
          messages = ParseSmsIntent(StartingIntent)
    For i = 0 To messages.Length - 1
    End If
    End Sub

    'Parses an SMS intent and returns an array of messages
    Sub ParseSmsIntent (In As IntentAs Message()
    Dim messages() As Message
    If In.HasExtra("pdus") = False Then Return messages
    Dim pdus() As Object
    Dim r As Reflector
       pdus = 
    If pdus.Length > 0 Then
    Dim messages(pdus.Length) As Message
    For i = 0 To pdus.Length - 1
             r.Target = r.RunStaticMethod(
    "android.telephony.SmsMessage""createFromPdu", _
    Array As Object(pdus(i)), Array As String("[B"))
             messages(i).Body = r.RunMethod(
             messages(i).Address = r.RunMethod(
             messages(i).Time = r.RunMethod(
    "getTimestampMillis")'------- i added here your code
    End If
    Return messages
    End Sub

    this error occurred..
    can't get the value of time

    thanks a lot...

  2. Erel

    Erel Administrator Staff Member Licensed User

    The screenshot posted doesn't show anything. We can't even see the code.

    What is the output of Log(SMSMessages(i).Time)) ?
  3. Joy Garcia

    Joy Garcia Member Licensed User

    My apologies for this post.. Please remove it for not complicating the same topic..

    Issues solve..

  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