Android Question B4A Login Form

Hikari

Member
Hi, I'm a new member and a beginner on programming. I'm making an app which consists of Log in form and application form to be filled, my problem is my username and password can't be evaluated. I have already watched some tutorials and read some threads in this forum regarding to my problem but still it can't be fixed, I use activity modules rather than b4xpages by the way. And I also use XAMPP as my database server. Can someone help me on my problem?

Thanks in advance!
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
   
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
    Type DBCommand (Name As String, Parameters() As Object)
    Private const rdcLink As String = "http://192.168.254.106:17178/rdc"
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private ButtonLogin As Button
    Private ImageView1 As ImageView
    Private LabelHead As Label
    Private LogAdmin As Label
    Private Panel1 As Panel
    Private Panel2 As Panel
    Private Panel3 As Panel
    Private Panel4 As Panel
    Private Password As EditText
    Private StudentID As EditText
    Private TextHeader As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("front")
   
    StudentID.Color = Colors.Transparent
    Password.Color = Colors.Transparent
   
    GetRecord
End Sub

Sub GetRecord
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("getId", Null)
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        req.PrintTable(res)
    Else
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
End Sub

Sub Activity_Resume

End Sub

Sub CreateRequest As DBRequestManager
    Dim req As DBRequestManager
    req.Initialize(Me, rdcLink)
    Return req
End Sub

Sub CreateCommand(Name As String, Parameters() As Object) As DBCommand
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = Name
    If Parameters <> Null Then cmd.Parameters = Parameters
    Return cmd
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Private Sub LogAdmin_Click
    StartActivity(Admin)
End Sub

Private Sub ButtonLogin_Click
    If StudentID.Text = "" Or Password.Text = "" Then
        Msgbox("Input Student ID and Password", "INVALID!")
        Return
    Else
'        GetRecord
    End If
End Sub
 
Last edited:

aeric

Expert
Licensed User
Longtime User
I hope you are not making the same mistake.
You are not passing any parameter to jRDC2, you're passing Null
 
Upvote 0

Hikari

Member
It still says error..
B4X:
ResponseError. Reason: java.net.UnknownServiceException: CLEARTEXT communication to 192.168.254.106 not permitted by network security policy, Response:
ERROR: java.net.UnknownServiceException: CLEARTEXT communication to 192.168.254.106 not permitted by network security policy
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
It still says error..
B4X:
ResponseError. Reason: java.net.UnknownServiceException: CLEARTEXT communication to 192.168.254.106 not permitted by network security policy, Response:
ERROR: java.net.UnknownServiceException: CLEARTEXT communication to 192.168.254.106 not permitted by network security policy
This is because Android does not permit non-SSL connection due to changes in targetSdkVersion. You can solve it by adding a line in manifest editor.

B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)

 
Upvote 0
Top