Month: October 2013

JDD Conference 2013

2013-10-12 Conferences, Java No comments

JDD 2013

In the beginning of the next week, there will be interesting conference connected mostly with Java technology in Krak√≥w, Poland. Lectures and workshops will be performed both in Polish and English language. Topics are not only connected with Java. We will be able to hear something about Big Data processing, front-end development, mobile development, Scala, design patterns, software architecture, Domain Driven Design and so on. It’s large amount of topics, so everyone should find something interesting for him or her.
See you there on Monday!

How to connect to Android device via TCP/IP?

2013-10-12 Android No comments

While developing Android applications, we need to debug them on real devices. We also should be able to access debug output and execute Unix shell commands. In Android device (mobile phone or tablet), we can go to Settings and then to Developer options. Afterwards, we can enable USB Debugging. Now, we can connect our device via USB cable to the computer and we will be able to access it via Android Debug Bridge (ADB). USB connection is standard way of debugging application on real devices. We can also use TCP/IP connection and debug applications wireless. In order to do that, we need to go through the following steps:

  1. Activate USB debug mode in Android device (it’s described above)
  2. Connect Android device to computer via USB
  3. Open command prompt (With Admin Right) and type: adb tcpip 5555 (note #1: in Windows OS, you need to have platform-tools directory from Android SDK directory assigned to system variable Path; note #2: 5555 is number of port we will be using)
  4. Disconnect your tablet or smartphone from computer
  5. Open command prompt type: adb connect IPADDRESS (IPADDRESS is the DHCP/IP address of your tablet or smartphone, which you can find by going to: Settings » About device » Status » IP address)

Now, you can use adb commands. E.g. adb shell or adb logcat. If you want to list connected devices or check if any device is connected to your computer, you can use command: adb devices.
Note #1: You shouldn’t use TCP/IP and USB debugging mode at the same time.
If you want to return to USB debugging mode, just connect your device to the computer via TCP/IP and then type: adb usb. After that, connect device to the computer via USB cable and you will be able to debug applications via USB connection again.
Note #2: In Android Studio you can use built-in terminal window instead of standard command prompt.
Note #3: Alternative way of returning to default debug mode (USB) is resetting the phone. You can simply turn it off and then turn it on and device will be in USB debug mode again.