Connect android client app to my own server

Hello,

I setup a kontalk server using docker, then I setup my android client app to use my own server. But when I try to register an error occurred during verification.

The following is the debug log on my mobile app:

2018-09-12 15:16:59 V/NumberValidation: Using phone number to register: ***********
2018-09-12 15:17:00 D/NumberValidation: phone number checked, sending validation request
2018-09-12 15:17:00 D/MessageCenterService: using server 10.1.1.128
2018-09-12 15:17:00 E/NumberValidation: validation error.
2018-09-12 15:17:00 E/NumberValidation: org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '_xmpp-client._tcp.10.1.1.128:5222' failed because: org.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp.10.1.1.128.	IN	SRV yielded an error response NX_DOMAIN, '10.1.1.128:5222' failed because: org.minidns.hla.ResolutionUnsuccessfulException: Asking for 10.1.1.128.	IN	A yielded an error response NX_DOMAIN, '10.1.1.128:5222' failed because: org.minidns.hla.ResolutionUnsuccessfulException: Asking for 10.1.1.128.	IN	AAAA yielded an error response NX_DOMAIN
	at org.kontalk.client.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:637)
	at org.kontalk.client.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:912)
	at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:409)
	at org.kontalk.service.XMPPConnectionHelper.connectOnce(XMPPConnectionHelper.java:193)
	at org.kontalk.client.NumberValidator.initConnection(NumberValidator.java:669)
	at org.kontalk.client.NumberValidator.run(NumberValidator.java:304)
	at java.lang.Thread.run(Thread.java:784)

2018-09-12 15:17:00 W/NumberValidator: shutting down
2018-09-12 15:17:00 W/NumberValidator: exiting

Hi and welcome.
What address did you put into the manual server address setting of the app? (or the serverlist.properties file if you built the app yourself)

In the android app I set 10.1.1.128 as the manual server address.

I know this is not very well documented, but the correct format for the manual server address in this case is:

xmpp_domain_name|host:port

In your case would be:

whatever_domain_you_defined_in_your_server|10.1.1.128

You can omit the port if it’s the default (5222).

I don’t have a domain name how can I use only my server IP ?

You don’t need one. If you use the format I suggested, you can use a fake domain name; Kontalk will use the IP address to actually connect, but the domain name (even if fake) is mandatory.
I guess you used your IP address as your XMPP service name here. If so, replace it with a fake domain name of your choice, and use it in the Android app in the first part of the address (before the pipe “|”)

after setting manual server to my_domain_name|10.1.1.128 and set xmpp service name to my_domain_name I obtain the following errors:

2018-09-12 15:55:18 V/KeyPair: key pair generated: org.kontalk.crypto.PersonalKey@b1a10bd
2018-09-13 13:33:19 V/KeyPair: key pair generated: org.kontalk.crypto.PersonalKey@bbd9c91
2018-09-13 13:33:50 V/NumberValidation: Using phone number to register: ***********
2018-09-13 13:33:52 D/NumberValidation: phone number checked, sending validation request
2018-09-13 13:33:52 D/MessageCenterService: using server my_domain_name|10.1.1.128
2018-09-13 13:33:55 E/NumberValidation: validation error.
2018-09-13 13:33:55 E/NumberValidation: org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '10.1.1.128:5222' failed because: /10.1.1.128 exception: java.net.ConnectException: failed to connect to /10.1.1.128 (port 5222) from /192.168.1.101 (port 51768) after 30000ms: isConnected failed: EHOSTUNREACH (No route to host)
	at org.kontalk.client.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:637)
	at org.kontalk.client.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:912)
	at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:409)
	at org.kontalk.service.XMPPConnectionHelper.connectOnce(XMPPConnectionHelper.java:193)
	at org.kontalk.client.NumberValidator.initConnection(NumberValidator.java:669)
	at org.kontalk.client.NumberValidator.run(NumberValidator.java:304)
	at java.lang.Thread.run(Thread.java:784)

2018-09-13 13:33:55 W/NumberValidator: shutting down
2018-09-13 13:33:55 W/NumberValidator: exiting

I see you’re using a different subnet, I guess you’re using Docker. You don’t have to expose the internal network (10.x.x.x), Docker will listen on port 5222 on your host machine. Just connect to the host, not the container.

10.1.1.128 is the IP of my host and not the IP of docker container

Ok then so it’s some other connectivity problem I can’t really help you about. Depending on your network configuration it might be right, but I see you’re connecting to 10.x.x.x from 192.168.x.x. Please check your network configuration, in general do some connection tests.