Android Question Sms interceptor error

Discussion in 'Android Questions' started by hookshy, Mar 15, 2015.

  1. hookshy

    hookshy Well-Known Member Licensed User

    I have problems with this error code here using sms interceptor .
    I have cut my program till the end hopeing to find the cause ...maybe someone could give me a clue after seeing this error code.

    my SERVICE CODE would be
    Sub Process_Globals
    Dim hsmes As SmsInterceptor
    End Sub

    Sub Service_Create


    End Sub

    Sub Service_Start(StartingIntent As Intent)

    StartServiceAt(""DateTime.Now +DateTime.TicksPerMinute*9 ,True)

    End Sub

    Sub hsmes_MessageReceived (From As String, Body As String)

    End Sub

    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.provider.Telephony.SMS_RECEIVED flg=0x10 (has extras) } in$SMSInterceptor$2@41ef9b40
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
  2. Erel

    Erel Administrator Staff Member Licensed User

    The correct signature is: MessageReceived (From As String, Body As String) As Boolean

    You can return true to abort the broadcast (this is no longer useful since Android v4.4 however you still need to return a boolean).
  3. hookshy

    hookshy Well-Known Member Licensed User

    You are so right ... fixed the problem thanks
  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