Android Question Problem connecting to API

Chris Guanzon

Active Member
Licensed User
Longtime User
Can anyone help me, i have this error using a device with built-in printer. my app is running ok in google phone. but when i try using it in a device with built-in printer running with android nougat, i'm getting this error:

B4X:
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: Handshake failed, Response:

and this error:

B4X:
(RuntimeException) java.lang.RuntimeException: Object should first be initialized (Exception).

Can anyone help me fix this. Thanks
 

DonManfred

Expert
Licensed User
Longtime User
How could we help here with this less information you provide?
 
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
this is my code:

B4X:
    Dim jsonString As String
    Dim returnValue As Boolean
    
    Try
        API.Path = "/xxxx/xxxx"
        Libraries.APIConnection.Initialize("Job", Me)
        Libraries.APIConnection.PostMultipart(API.URL & API.Path, CreateMap("something":EditText1.Text, "something":EditText2.Text, _
             "someversion":Application.VersionName),Null)
        Wait For (Libraries.APIConnection) JobDone (j As HttpJob)
    
        If j.Success Then
            Dim parser As JSONParser
            jsonString = j.GetString
            parser.Initialize(jsonString)
            Dim root As Map = parser.NextObject
            Dim message As String = root.Get("message")
            Dim status As Int = root.Get("status")
            
            Select Case status
                Case 0
                    'can't put the code here, i deleted it
                Case 400
                    MsgboxAsync(message, "Error")
                    Wait For Msgbox_Result
                    returnValue = False
                Case 422
                    MsgboxAsync(message, "Error")
                    Wait For Msgbox_Result
                    returnValue = False
                    
                Case Else
                    MsgboxAsync(message, "Error")
                    Wait For Msgbox_Result
                    returnValue = False
            End Select
        Else
            MsgboxAsync(LastException,"")
            Wait For Msgbox_Result
            Log(LastException)
        End If
    Catch
        'Log(LastException)
        MsgboxAsync(LastException, "Error")
        Wait For Msgbox_Result
    End Try
    Return returnValue

I can't give more because this is a live and running app. Already published in playstore.

No other error except the error i posted above.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
A last chance to provide more informations.

What is the Device you are using?
Where can we found the Documentation of this Device/this Api? URL
Where can we download a example project the Devicemanufacturer provides? Eclipse or Android Studio java Example.
 
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
A last chance to provide more informations.

What is the Device you are using?
Where can we found the Documentation of this Device/this Api? URL
Where can we download a example project the Devicemanufacturer provides? Eclipse or Android Studio java Example.

I am using Mobile Payment Terminal, see attached picture.

1586323483716.png


You can find more info here: http://www.whty.com/product/id/5.html

I don't have a sample app or project for this from the manufacturer.
My app is running ok and no error in android phone, but not ok in this device.

Thank you @DonManfred for helping me, hope this will give you more info. Sorry for my bad english, I am not really good in english.
 
Last edited:
Upvote 0
Top