Control a serial device (like usb printer) from an Android app - android

I have two questions about Linux Android.
In the documentation it says:
"Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device."
And apparently there is a way to send a command to serial port (USB) from ADB (Android).
So, I need to send commands (like AT commands) from android device to usb device (printer)
1) The ADB will be present on a real device with android?, which version?
2) is there another alternative?
Thanks in advance

And apparently there is a way to send a command to serial port (USB) from ADB (Android).
Not that I am aware of.
The ADB will be present on a real device with android?
adb is a program that is part of the Android SDK. It runs on your development machine. It does not run on the emulator. It does not run on the device.
is there another alternative?
Use the USB APIs and the Open Accessory Development Kit, perhaps.

Related

How to connect Android device as Jenkins slave to execute automatic tests

I am trying to execute automatic tests using robotframework + appium + Jenkins.
My biggest problem is to set up the necessary infrastructure.
I have a Windows VM (slave) with 4GB RAM but the emulator took more than 30 minutes to getting started.
I do not have a physical server to connect the device by USB.
How can I set this up in a efficiently way?
Is it possible to set up an Android device directly as slave (connected to master via wi-fi) and install robotframework in the device?
How many RAM/CPU I need If I need to get a better VM where I can handle the emulator efficiently?
I appreciate suggestion. Thanks.
It is very unlikely you manage to configure your Android phone as a Jenkins slave. It's just too many libraries that you would need to build on your own so they run natively on Android. You would need to have the Jenkins slave, Appium, Robot Framework and your app running in the same phone, which isn't as powerful as any regular computer.
However, if your device is rooted, you can try something like WiFi ADB to at least get the lowest level layer to your phone available over the air. There is also a manual setup with no software available at How can I connect to Android with ADB over TCP?.
If rooting is not your option, but you can connect the device through USB just once (which I assume you can't do because probably you're using a cloud host like Azure and that's why you can't physically access the machine), do it and run adb tcip 5555 (or your desired port). This will allow you to desconnect the device and use it over WiFi with the trusted computer connected through USB (until you kill the ADB server!).
After any of both procedures, configure your project as usual and set the udid capability to the IP of your phone in the network (try to configure a static IP address) and its port, for example 192.168.0.24:5555. Before running the tests, you have to run adb connect 192.168.0.24:5555 so adb is aware of the device and Appium can find it.
You still will have some trouble getting the VM and the phone in the same network, but for that issue there are plenty of options available like configuring a VPN.

How can I enable wireless interfaces on TWRP terminal with no OS no ADB (Android)

I had some problems flashing a new ROM on my android phone. The result is that I have no OS running/installed on it and I can't access the device from my Mac (drivers should be ok).
I have no ROM stored on the device so I can't install a new/old one. If I can't connect the device using adb/fastboot, how can I push a new OS to install? (Already tried ADB sideload but no detect the device)
I've tried to enable the wireless interface, connect to my WiFi and download the files using wget. But I can't even find it. Using ifconfig only shows those:
dummy0
lo
sit0
The only way I can interact with the device is using the terminal included in TWRP. If I can't access the device using USB I guess it won't detect an OTG connector. Any ideas?
Thanks!

Accessing same android device from Different platforms

I have windows, Ubuntu & Android platforms in the same network.
I can access the android device after connecting through adb connect <IP> command.
But I could access the android device through the Platform in which I have connected first. In the second platform it is showing device offline.
Is there anyway to access the android device from both windows & Ubuntu?
It has nothing to do with your 2 systems being "different platforms". An attempt to connect to the same adb devices from 2 Windows systems (or 2 Ubuntu systems for that matter) would produce the same result. adb was not designed to be used this way - adbd daemon on the device can only be connected to 1 adb host at a time.
Instead connect your android device to your Ubuntu system and use whatever remote access solution you prefer (x server, vnc, ssh, etc) to control it from your Windows system.

Linux CLI into Android

I was wondering if it is possible to terminal into my Android (Razr) and navigate the file system and processes like you would on any other Linux distribution. As it is supposed to be built on top of the Linux Kernel.
I find it annoying that you simply can't shut down most apps, like Firefox for example, from the phone's default UI, I wish there would be a way to find the process ID and kill it like you would on a regular Linux/Unix machine.
If you enable debugging and have the Android SDK installed then you can use adb shell to get a shell on the android device using the USB cable to a PC. If you want something just on the device, ConnectBot which is a SSH client application that is available for free, can provide a localhost only shell which will let you work as for most linux systems. Note that the shell is fairly restricted. A lot of common commands are missing.
adb shell
with your phone connected to your PC, via network or USB according to your device, with USB debug enabled.
I use the connectbot app; it's primarily useful as an ssh client but also allows you to run a local terminal session

Android tcpip ADB session disconnects when accessory is attached

I am developing an ADK application using Windows 7 x64, API 15 with a target of an Acer Tab A100 running Android 4.0.3 and an Arduino with a USB shield. The tablet is not rooted.
I am able to successfully setup ADB to run over tcpip using the following command in a Windows command shell:
adb tcpip 5555
adb connect X.X.X.X
I then disconnect the usb cable from the Windows 7 PC and connect it to the Arduino. The Arduino is running the ADK code and the tablet prompts to launch my application. The application launches and runs fine. However, when the Android application launches the ADB session terminates and I have to re-execute the adb connect command to re-establish it.
This doesn't seem like it should be happening. Does anyone have any thoughts how to fix it?
Thanks,
digitalhack
ADB server can be started from android ADK based application, it will communicate with firmwate in the Arduino.I developed one project using ADB communication with Arduino, work fine.
Thanks
It shouldn't be necessary to use ADB for app communication over USB. I'm deep into this right now and am trying to get openAccessory to work for this exact purpose (communicating with Arduino). openAccessory causes the Android device to operate in "device" or "slave" mode, permitting the Arduino to be run in "host" or "master" mode. Since the USB host is the one that powers the USB bus, this permits the Arduino and its (presumably) more powerful power supply to power the Android tablet rather than the other way around.
Read up on openAccessory mode in the Android API, and report back on your results!

Categories

Resources