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
    Code:
    Sub Process_Globals
        
    Dim hsmes As SmsInterceptor
    End Sub

    Sub Service_Create

         hsmes.Initialize(
    "hsmes")

    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


    Code:
    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.provider.Telephony.SMS_RECEIVED flg=0x10 (has extras) } in anywheresoftware.b4a.phone.PhoneEvents$SMSInterceptor$2@41ef9b40
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:812)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5473)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:854)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
    at anywheresoftware.b4a.phone.PhoneEvents$SMSInterceptor$2.onReceive(PhoneEvents.java:398)
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:792)
     
  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
     
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