Newbie Question: Class Writing

sktanmoy

Active Member
Licensed User
Longtime User
I'm trying to write a class to check if internet connection is available. Code is

B4X:
'Class module
Sub Class_Globals
   
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize

End Sub

Public Sub Status As Boolean
   Dim P As  Phone
   If (P.GetDataState == "CONNECTED" ) Then
   Return True
   End If
End Sub

But not working while I'm trying to use it.

B4X:
Dim net As Connection
   If net.Status = True Then
   Msgbox("Connected", "")
   Else
   Msgbox("No Connection", "")
   End If

Please help me to understand the error.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…