Android chat working on emulators with redir - java

I have read tons of this same advices about connecting two emulators using telnet. For example this one: Connecting 2 Emulator instances In Android
I've made all as it is said and nothing works. I have got server app on emulator 5554 and client app on emulator 5556. They are using ports 6000 server app and 5000 client app. What I want is to communicate when this two emulators are open - in both ways.
At the beginning server app shows her ip, and in client app user have to write this ip. That is whole configuration.
As in mentioned post was said I've written redir add tcp:5000:6000 but nothing works. Also when I write redir add tcp:6000:5000 nothing happen. Those apps don't hear each other. However if server is on other device than everything works fine.
Maybe it is stupid question but can someone guide me through this, because I don't know what am I doing wrong.

Related

App (Android) can not connect to the server

I have a problem with my android application. In Android Studio, everything looks normal since no error appears. The application is supposed to connect to the web server for data recovery. But every time I test the app on my android device or on an emulator, I still have the same message: "Appname can not connect to the server"
So, since I do not see any error on Android studio, I do not know where to look. I tried with the coordinates of two different servers, but still the same message. I have concluded that the problem is not at the level of the connection to the server, but in my code, but where?
If anyone has any suggestion, I'm a taker. If you need to see any file, let me know.

TCP connection between Android App and PC

I'm trying to create a TCP connection between my PC and Android smartphone to send text from the PC (Client) to the Android App (Server).
I found a tutorial which helped me with the code for the App which creates the server ( http://pastebin.com/z0xPSAvP ).
Now I'm struggling connecting my client with the server. The client is programmed with "AutoIt"
http://pastebin.com/tCW5bK9V
When I run the client the "could not connect to $socket" msg-box is displayed.
Could someone tell me what I'm doing wrong here?
Both devices are in the same Network (smartphone via WiFi and PC via LAN) and I checked for the smartphones IP in the smartphone settings.
First, try to access something like Google from your Android phone using its mobile browser. Maybe something still wrong with the network.
Then create a version of the server that could deliver simple HTTP response, visible from the Android mobile browser. Doing so with success eliminates firewalls and all client-related issues from the list of possible problems, making sure the server works and is accessible.
If it still does not work after you demonstrate connection between server and mobile browser, I would suggest to write the client in Java first using the this tutorial. You can try AutoIt and other more exotic approaches after you get anything working at all.

Android connection to router

I am developing an android application and it requests connecting to a linksys router and i wrote a code on java and it is working but when i tried to transform it to an android application i face a timeout exception in this line
JenNetIPNetwork network = service.createNetwork(new InetSocketAddress("fd04:bd3:80e8:2:215:8d00:32:54ff", 1873));
and i am using an emulator.
So is the problem that i am using an emulator not an android device?
And if there is other solutions any suggestions ?
There is possibly 2 problems.
1) your immolator is not connected with router (its your computer.) so try to connect immolator to router or use real device.(this problem has major chance to generate this bug.)
&
2) All networking related stuff in android must be in other thread. try that out.
Try this hope your problem would be solve by this.
one more thing you have to add internet connectivity permission in xml.(if not then do as well)

Bluetooth Android issue

I am running a multi thread application on android and adobe air, in native android 2 bluetooth sockets are set up and a couple of server threads for the air app to communicate with the bluetooth sockets of native android. It's basically socket programming and it all works on one device I used to programme it.
The device i used to develop this app was slow, i therefore got myself another tablet to test (android vega) and it is very fast at communicating my bluetooth data as it has 2.1edr version.
The problem is with the Advent Vega tablet the bluetooth streams just disconnect for no apparent reason intermittently and in the adb log window i just get trying to connect to device all of a sudden when the disconnect occurs, i have no mention of the crash anywhere in the log, this happens to both bluetooth connected threads at the same time so it must be something to do with the bluetooth radio im suspecting. The other tablet device runs the app fine but slower (no disconnects). I have even installed a custom 3.0 rom on the vega to see if it was a os problem but the disconnect problem persisted on 3.0 as well.
Due to the fact there is no mention of this in the adb log i am just basically staring at a screen with no idea of why it disconnects for 2 days now!! The only way to get the app to run again after this disconnection occurs is to restart the bluetooth on the device but this disconnect occurs again eventually when next run. It seems to improve the amount of time it stays alive tansferring data when the app is first run afater a re boot.
I have gone through all code of the run() and stopping() of each thread and it seems to exit gracefully, i close the bluetooth sockets only, it seems from research no need to close the bluetooth input and output but i have also tried that approach to closing.
Can anyone offer suggestions as to why both bluetooth read/write loops would just stop all of a sudden and disconnect? Seemingly effecting the adb log as well as it just says trying to connect...
Or any suggestions as to how to better debug when this occurs?
Or even what somebody else would do in this situation.
Hope someone can help, i have a great phone remote app for the android tablet owner community and it hinges on this final issue which i have been stuck on for 2 days.
I had problems with disconnects, and implemented a keepalive by sending a ping request and a ping ack.
This worked fine for me...

Implementing native android code with AIR code

After following these instructions to integrate Adobe AIR with native Android I have a few issues.
I have managed to get a bluetooth connection going in native android, setting up 2 BluetoothSockets which then shows the air app also packaged within the apk. This included air app requires 2 connections to somewhere (normally wifi).
I have it connecting to TestService1 and TestService2, which is then passing the traffic between these services and the BluetoothSockets.
It is a little slow as i have to put Thread.sleep(80) in between reading from bt socket and writing to the AIR app for it to work currently.
My 2 questions are
Is there any way to get the AIR app to know about and access the Bluetooth Sockets created in the Android code rather than having the 2 Services being the middle men?
Is this kind of release (hybrid) allowed in Android Marketplace does anyone know?
Really hoping to find an answer to question 1 as currently my bluetooth server is continously sending data and using the TestService1 and 2 to get this bluetooth data to the AIR app and is causing a 10 seconds lag.
Thanks in advance
These apps are definitely allowed in the Android market.
You should be able to send Bluetooth data immediately over the socket to the AIR app. It doesn't seem like you should need 2 separate services or a sleep. I think your service that is talking to the Bluetooth can also listen on a socket and send data over that socket when it gets it.

Categories