ABwifi crushing my app

melamoud

Active Member
Licensed User
Longtime User
anyone know what this error is ?
B4X:
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in com.AB.ABWifi.ABWifi$WiFiScanReceiver@4064ea80


   at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:130)
   at android.app.ActivityThread.main(ActivityThread.java:3806)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.AB.ABWifi.ABWifi$WiFiScanReceiver@4064ea80
   at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:610)
   at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:900)


   at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:338)
   at com.AB.ABWifi.ABWifi$WiFiScanReceiver.onReceive(ABWifi.java:175)
   at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
   ... 9 more
** Service (scheduler) Create **

the only code I have with abWIFI is this
B4X:
Sub onWifi As Boolean
   'Utilities.LogM(0,"Starting onWifi Sub")
   Dim myWifi4IP As VBConnect 'to get IP
   Dim mywifi As ABWifi   'to get ssid
   Dim WifiStr As String
   Dim loadB As Boolean
   Try 
      loadB = mywifi.ABLoadWifi()
      If (loadB AND myWifi4IP.weconnected = "YES") Then
         Return True
      Else
         Return False
      End If
   Catch 
      Utilities.LogM(0,"error in WIFI lib" & LastException)
      Return False
   End Try
End Sub
 

agraham

Expert
Licensed User
Longtime User
That's a very odd error. It's complaining that the ABWiFi is trying to unregister an unknown BroadcastReceiver, but in fact ABWiFi has previously registered it and is just tidying up.

Apart from the fact that I don't know what a VBConnect is, that Sub works fine for me so maybe there is some surrounding context that is affecting it. Post the smallest project (File->Export as Zip) that demonstrates the problem and I will try it.
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
The problem happen every few days
I have the exact sub in some other app and it never happened
Vbconnect is another lib.

What I'm trying to do is simple return true if wifi is enabled and connected the idea is to stop my service if user is using Tue mobile data plan . Work only if he is using wifi.

It wont be easy to reproduce on small project maybe not possible.
 
Upvote 0

leongcc

Member
Licensed User
Longtime User
I encounter the same error as melamoud.
I use both AbWifi and BroadCastReceiver in my app.
The error happens when ABLoadWifi() is called in the same Sub as the initialization of BroadCastReceiver.
So I call ABLoadWifi() somewhere else in the source codes, and the error went away.
 
Upvote 0
Top