adb shell: telnet command doesn't work - android

i want to learn how to mock up location in android device and develop a location based app. My problem is when I say adb shell in the command prompt it lets me go into the emulator with # symbol.
problem starts here
When I enter telnet localhost 5554 to telnet the device it says telnet: not found
what could be the problem?? am I doing something wrong?

you don't have to telnet with adb. Just use a normal command line window to type in telnet localhost 5554 - but don't enter adb before!

You don't have telnet installed.
In ubuntu install it by:
$ sudo apt-get install telnet

Related

In Linux it's iwconfig, what about Android

In Linux I can call iwconfig to get the info about wifi spots. How can I obtain the same kind of information in Android?
The exact same iwconfig exists on Android too. You can connect into your Android phone using adb shell over USB and run the iwconfig command.
You can install adb shell on your PC. Here is the instruction - http://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378
Connect your Android phone to your PC over UDB
Open Command Prompt
Run adb shell inside the Command Prompt
adb shell provides bash like shell to run command on the Android phone. Run iwconfig in the adb shell
iwconfig for Android ia also available from https://github.com/nvamelichev/wireless-tools-android
Android IS almost linux, you can install a terminal program. and run commans (I use JuiceSSH)
There is a command that is in almost all linux, and in Android too (My android have it)
IP Command
You can type ip addr, ip link, ip route and other parameters to set or get your address or other info, like routes

ADB tcpip command without cable

I need remote ADB shell..
I know that we have to issue "ADB tcpip ".. to change ADB server to TCP listening mode.
But, the problem is that my phone is not rooted, and I do not have USB cable.
I can't issue tcpip command since I do not have USB cable,,
I can't change default.prop file as the phone is not rooted.
Is there any other ways to change ADB server to TCP listening mode???
I found an articel that says you can execute setprop persist.adb.tcp.port 5555 to make tcpip mode autostart after reboot.
The problem is, you must run this command as root.
On my device unfortunally the command su doeas not exist.
Here is the orginal Permanent network debugging on android
EDIT: I discovered, that the su command is only available when your device is rooted.
So the solution only works when you have a rooted phone
The simple answer is: no, you can't.
As you said, you can't access the prop file and don't have a cable to change with ADB. The only way is you find the port via an Android terminal emulator (a.k.a Termux)
For anyone looking for a better answer:
YES, YOU CAN!!
When you try to execute "adb tcpip 5555" without an USB cable, it returns:
"error: no devices/emulators found"
Emulators?? After googling I found the way and made a batch file that connects my device directly through WIFI, no cables needed at all:
set /p ip= Device IP:
:CONNECT
if "%CD%"=="C:\" goto ROOT
cd ..
goto CONNECT
:ROOT
cd ...Android\Sdk\emulator
echo.
echo Starting emulator...
start /MIN emulator -avd Nexus_5X_API_29_x86 -no-window
(you can check other avaliable devices with "emulator -list-avds")
cd ..
cd platform-tools
adb wait-for-device
echo.
echo Emulator started.
echo Connecting with device...
adb tcpip 5555
adb connect %ip%
echo.
echo Closing emulator...
(you need it just to be able to execute "adb tcpip 5555")
adb -s emulator-5554 emu kill
(you can check the name with "adb devices")
To enable wireless debug need to configure the ADB command. (in mac os)
Step1:- First of all need to enable adb command. (check SDK tool and install command-line tools)
Step2:- connect the device with a USB cable after that run the below command.
command: adb devices
the above command will show a list of connected mobiles.
Step3:- after that, we need to configure TCPIP protocol:
e.g : adb tcpip 5556
Step4:- Run command to connect the device.
command: adb connect your_ip:port_address
eg:- adb connect 192.168.1.152:5556
If you are using the stock android os system, then you can enable remote debugging in Settting -> developer options.

Telnet to Android Emulator with puTTy

I am using windows 7 and I need to Telnet to my android emulator to be able to run a location app. How would I go about doing that? The only tutorials I am finding have been for linux...
Use RAW as Connection Type and not Telnet.
Use the following parameters.
hostname: localhost
port: 5554
You 1st need to enable telnet because windows 7 has it disable by default:
http://www.itdoescompute.com/2009/10/29/how-to-enable-telnet-in-windows-7/
Alternative, download Putty # http://www.putty.org/ and connect to your Android. I believe its "localhost:5554"
You could simply connect to your Android via the ADB Shell instead of online; adb -e shell
How to use ADB Shell:
http://www.londatiga.net/it/how-to-use-android-adb-command-line-tool/
Launching an App, Answer by Cristian (view profile)
How to start an application using android ADB tools?

How to interconnet two android emulators

I need to create the data connection between two android
emulators running one on machine.
I am not sure, but it probably should look like this:
//server start
adb devices
adb -s emulator-5554 kill-server
adb -s emulator-5554 start-server 10.0.2.15:5580
//redirection
telnet 127.0.0.1 5554
redir list
redir add tcp:8080:5037
//connection
adb -s emulator-5556 connect localhost:8080
Then I want to use it with this (socket programming):
http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-pro...
But it's probably not working properly and I don't know where the
problem is or how test it with simple udp program like this
http://www.helloandroid.com/tutorials/simple-udp-communication-example

How do you connect your terminal with the Android emulator

I have tried the navigate to the android tool folder and entering the "adb shell" command but it doesn't seem to work. My terminal seems only to recognize the adb part of the command and gives me an error message. What am I doing wrong???
List all connected devices by typing adb devices
Check, if there are any devices listed. If not you may want to check that your device is connected and/or your emulator is running.
If it works and you have for example your emulator running and your usb-device connected use:
adb shell if you only have device connected.
adb -d shell to connect to an USB-Device.
adb -e shell to connect to an emulated device.
If you have more than one emulator or usb devices you might want to use:
adb -s <DEVICE> shell
Note:
Make sure that the path to the android-sdk is properly set-up in your environment. To quickcheck, fire up a shell and type adb version. If that command succeeds, you're set up. If not, add /path/to/android-sdk/tools and /path/to/android/platform-tools to your $PATH env variable. On windows the android sdk is typically located in C:\Users\<username>\AppData\Local\Android\sdk.

Categories

Resources