Streaming Audio Via SSH to an Android Device - android

I'm able to securely stream audio from one PC to another via SSH using:
ssh <username>#<host> 'dd bs=1k if=/dev/audio' > /dev/audio
Is there any similar way to do this from a terminal running on an Android phone? I tried testing this from a terminal emulator running on a Droid X, but the standard "/dev/audio" device is missing.
Note, I realize this could probably be accomplished by writing a custom app, but I'd like to avoid that overhead.

Another way would be to install a streaming server (i.e. icecast) on the Linux box and connect to it from your Android using any Internet Radio Client.
IIRC, icecast support authentication and SSL.

No, there is no way to do this. By default android phones do not run SSH, nor do they have /dev/audio available (I'm actually uncertain where the audio path on most android devices terminates).
I see a custom app in your future.

Related

How to synchnorize files with mobile phone running LineageOS?

I have a mobile phone running LineageOS 16.0. I would like to organize the automatic synchronization of particular directory on mobile phone with some remote directory (e.g. exposed via FTP/SMB/SSH) on the server. Ideally would be to have an option either to make one-way (synchronize only missing files) or two-way (source and target are identical after synchronization) modes.
In particular above can be achieved by using the rsync utility. I see the following options:
Mobile phone is exposing the folder via e.g. SSH
This would require LineageOS running SSH server. In this case rsync could be run on the server (periodically or on some event).
Is SSHD server already installed on LineageOS (Native SSH server on LinageOS)? If not, is it possible to install it from a package?
Will running in the background sshd daemon drain the mobile battery?
How difficult would be to add it to startup (SSHD on LineageOS, Execute Script on Start Up)?
Mobile phone is running rsync
This requires rsync installation to LineageOS. Maybe there is ready-to-use package or will it require the compilation?
I would need an icon (or some other easy way) to execute rsync on mobile. How to organize that?
If you see other more handy/easy options, please describe how to setup/organize them.
P.S. Dropbox or any other cloud solutions is not an option (out of scope for this question).
Thanks in advance!
I use the FolderSync app for this (it supports connecting to an SSH server at scheduled intervals, although I personally use it with Nextcloud). Syncthing is also a good solution I've used in the past, although you'll need to install that on your server also (no cloud required).
Trying to run an rsync server on a phone doesn't sound appealing, but there are a couple of rsync client apps in the play store.

How to connect an Android app with a c++ program on pc via USB

Require a method of connecting an android app with a C++ program on PC via USB, which would allow the android app to send a constant stream of real time data (mostly integer values) to a c++ program on PC via USB and carry out actions accordingly. I know it is easier to do this by wifi or bluetooth, but I want to carry out the connection using USB.
I have searched the net alot for similar questions, and tried many code, but non of them have worked for me. I would greatly appreciate an example code for the c++ portion, and it's android counterpart that allow for this to be done easily.
You could use the USB Tethering option on the phone. This should work with Android 4.4 and the most popular Linux Distributions out of the box. Then you are able use TCP/IP between Android and the PC. You could use an UDP multicast based protocol for service discovery (e.g. Multicast DNS, NSD or SSDP) if you need to avoid entering IP addresses on one side.
One way of doing this is to setup your pc application to talk to the android device as an android accessory. http://developer.android.com/guide/topics/connectivity/usb/accessory.html
This will allow both applications to send whatever data they want over usb, Google do provide source code for doing this with the accessory development kit http://developer.android.com/tools/adk/index.html
I don't have any example source code but there might be some out there if you search.
You can use ADB and call custom commands on your Android device. This commands should just type integers to stdout. As an option, you can use standard shell commands like cat and make your Android app write output integers to files in some directory where ADB can read it.
You can have Android behave like a USB device with a USB CDC (ACM) interface, which is seen as a serial port on the PC (COMx on Windows, /dev/ttyXXX on Linux). On C++ (PC) side, this would be "regular" serial port handling, while on Android there are several libraries for such purposes, though I never used one so I can't recommend any.

Android running command on windows

is there any android library or application to send command or keystroke or mouse click to Windows from android app?
I have an android project that need to run an application on windows with a touch on android.. the android app will have 4 big button which is used to send command to windows..
I expect there is an android library and server app for windows.
Have a look at this answer: https://stackoverflow.com/a/10140812/1291122 .There are no android libraries for that. You need to write it all yourself!.
However I feel(haven't tried yet) that you can use the bluetooth API to establish a connection between your android device and your windows pc and exchange data(command strings like "LEFT","OPEN","SHUTDOWN") by managing the connections.At the same time, you may have simple ServerSocket running on windows which accepts connection from your android device and decodes the command strings received and performs actions accordingly.
There are many applications available in the market which do the same thing. I guess they use a similar(not exact) approach.

Desktop PC and Android interface

I'm thinking to develop a PC desktop program to get application setting from android phone, install/uninstall apk application, sync photos/videos/music and display a web content.
Initial thought is to use .Net to write desktop program and shell ADB tool to do installation and file copy on android phone. However seems like advanced feature of ADB only works on a rooted android phone.
Is there an communication interface between windows and android system? Based on an app called "Android Manager" by Mobile Action, it seems that it can pull out what apps are installed on the phone but seems like this cannot be done by ADB alone without root access.
I would like to do the transfer of information using USB cable. Any thoughts where to research on? Thanks much
If you want to use the USB cable you can only use ADB, but you can use ADB to set up a socket between your pc and the mobile device. Both sides can then connect to this socket and use it to transmit data.

Android: Communicating with a USB device which acts as host

We have made a device which can act as an USB host or slave and processes the data it receives. I want to use the Android phones to send the data to it via USB.
My research leads me to conclude that we cannot use Android devices in USB Host mode without modifying the hardware or OS. Doing so is not an option as this is going to be a commercially deployed device.
However, I couldn't find any information on using the Android phone as a slave. This is already technically possible because it can connect to the PC in a similar configuration. Can we do the same via an application? If so, any information on how to achieve this will be greatly appreciated. I have full access to our device's embedded system, so custom code there should not be a problem.
This is already technically possible
because it can connect to the PC in a
similar configuration.
Only for things baked into the firmware. Your SDK application cannot invent new Linux device drivers, nor does it have any access to the Android device side of the adb connection.
Can we do the same via an application?
Since you have not said what you are trying to do, this is impossible to answer in a definitive fashion.
Say, for example, the "device which can act as an USB host or slave and processes the data it receives" wants screenshots off of the Android device. That is eminently possible via adb, because adb has a protocol for that built in. All you would need to do is have your device connect to the Android device via the adb protocol and request screenshots, no different than does DDMS or hierarchyviewer.
So, I would look at the problem from a different perspective: if you can accomplish it via DDMS, you can do it via your custom device. If you can accomplish it via adb shell commands, you can do it via your custom device. If you cannot accomplish your goals via existing interfaces, though, since you have no way to invent new ones over USB, you will be stuck.
Conceivably, you could plug your custom device into a Bluetooth or WiFi dongle, then use those on Android for communication.

Categories

Resources