Android Question Routine WAS working, but now its not...

kepler

Active Member
Licensed User
Longtime User
Good evening,

I was testing ABWifi lib, v 1.2, with the following code:

B4X:
Sub Process_Globals
    Dim lat As Double
    Dim lon As Double
End Sub

Sub Globals
    Dim MyWifi As ABWifi
End Sub

Sub Activity_Create(FirstTime As Boolean)
    
   Dim r As Boolean
   r = MyWifi.ABLoadWifi()
   r = MyWifi.ABGetLocation("MyWifi")
   If r = False Then
      r = MyWifi.GetLastKnownLocation("MyWifi")
      If r = False Then
         Msgbox (MyWifi.ABWifiLastError(), "")
      End If
   End If
   Msgbox ("" & lat & " - " & lon, "")
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
End Sub

Sub MyWifi_FoundLocation ()
   Dim ResLocation As ABFoundLocation
   ResLocation = MyWifi.ABGetFoundLocation()
   lat = ResLocation.Latitude
   lon = ResLocation.Longitude
   Msgbox ("" & ResLocation.Latitude & " - " & ResLocation.Longitude, "")
End Sub

The problem is that at some time I received the second message box with my coords right.
But now, I'm only getting 0 - 0 values with the first message box, and the second doesn't appear.

I really know I'm doing something wrong.

Can someone please help me out?

Kind regards,

Kepler
 

kepler

Active Member
Licensed User
Longtime User
Hi,

Same thing is happening with another routine... I can't seem to be able to assign the proper values to a variable that I want to be Global.
If I declare a variable like Var1 in Sub Process_Globals, can't I change it and access it in other sub routines?

Kepler
 
Upvote 0

Troberg

Well-Known Member
Licensed User
Longtime User
I can't seem to be able to assign the proper values to a variable that I want to be Global.
If I declare a variable like Var1 in Sub Process_Globals, can't I change it and access it in other sub routines?

You need to specify the module. So, if you have a module called MyModule, with the public variable MyVar, you'll have to access it with Mymodule.MyVar.
 
Upvote 0

Alisson

Active Member
Licensed User
I have got this message:

B4X:
B4A version: 5.50
Parsing code.    (0.00s)
Compiling code.    Error
Error compiling program.
Error description: Unknown member: abloadwifi
Occurred on line: 13
   r = MyWifi.ABLoadWifi()
Word: abloadwifi

What to do?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top