Android Question android.system.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)

Discussion in 'Android Questions' started by Zeev Goldstein, Aug 28, 2019.

  1. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    hi

    i'm trying to send email from my app using gmail
    on one phone it works
    on the other one i get this error

    both are android 9.1

    this email account is set for low security so i can use it without 2 factors or gmail auth api

    as said - one phone works perfectly on other i get this error

    BTW - i get all permissions etc...

    anyone can open my eyes ?

    thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you sure that the problematic device is connected to the internet?

    Try to add this to the manifest editor:
    Code:
    CreateResourceFromFile(Macro, Core.NetworkClearText)
     
  3. DonManfred

    DonManfred Expert Licensed User

    Wouldn´t the error look other if one tries to access a api using http (not https)?
     
  4. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    thanks for your reply
    yes - device is connected to the internet ans has full signal

    the line you suggested made no change and i keep getting the same error
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    The wifi strength is not really relevant. Open the device browser and navigate to gmail.com.

    Also post the relevant code and the full error message.
     
  6. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    i did try browsing to a few urls - all worked
    there is no other error - the error i get is the one in the post title

    i just try to send a simple email through gmail smtp - as said on one device works like charm on another one not and i get this error
     
  7. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    BTW - tried on wifi and on cellular - same thing
     
  8. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    and this is the code i use

    Code:
    Sub SendEmail()
        
    Dim mail As SMTP
        
        
    Dim SMTP_SSL_Port As Int = 465    'for SSL
        Dim SMTP_TLS_Port As Int = 587    'for TLS

        
    Try       
        
            mail.Initialize(
    "smtp.google.com"465"MyUserName@gmail.com""MyPassword""SMTP")
            mail.UseSSL=
    True
            
            
    Dim M As Map
            M.Initialize
            M.Put(
    "From","MySelf <MyUserName@gmail.com>")
            mail.AdditionalHeaders = M
            
            
            mail.To.Add(
    "SMTP_SendTO")

            mail.Subject = 
    "SMTP_Subject"
            mail.Body = 
    "SMTP_Body"
            
            mail.AddAttachment(fPath, fName)
            
            mail.Send
            
            
    Wait For smtp_MessageSent(Success As Boolean)
            
    Log(Success)
            
            
    If Success = True Then
                
    ToastMessageShow("Message sent successfully"True)
            
    Else
                
    ToastMessageShow("Error sending message"True)
                
    Log(LastException.Message)
            
    End If

        
    Catch
            
    Log(LastException.Message)
            
        
    End Try
        
    End Sub
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    It is a network problem. This is all that I can say.
     
  10. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    Thanks
    That's odd
    Both phones are side by side
    Both have full internet access
    One works one doesn't
    I've checked on wifi and on cellular
    What else can i check or do?
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    1. Restart the device.
    2. Test it in airplane mode with wifi enabled.
     
  12. Zeev Goldstein

    Zeev Goldstein Active Member Licensed User

    Found the problem & easily resolved.
    There was nothing wrong in the app or phone or network.
    I have adguard and it was blocking network access.
    Marked the app as safe and voila it works like charm.
    Silly me..
    Thank you all who tried to help
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice