I launch an AVD, it doesn't seem to matter which one but I have tried Nexus 4 and with API 18 and 25, and then connect via telnet to send commands. It connects fine, auth is fine, but then a command like "network speed edge" or "network speed full" results in:
KO: unknown command, try 'help'
Ok, fine I can look at the help, but there is no network-related command in the list of available commands:
help
Android console command help:
help|h|? print a list of commands
crash crash the emulator instance
kill kill the emulator instance
quit|exit quit control session
redir manage port redirections
power power related commands
event simulate hardware events
avd control virtual device execution
finger manage emulator fingerprint
geo Geo-location commands
sms SMS related commands
cdma CDMA related commands
gsm GSM related commands
rotate rotate the screen by 90 degrees
Additionally, I'm running the newest Android Studio, completely updated, on Linux Mint 18.1. Other commands like "geo" and "power" work as expected.
The network command is not already neccesary because the android studio provides you a tool bar from where you can change the network type.
It was so easy for me to do it. this tool bar shows up next to the emulator screen.
Related
I'm connecting an android device to an FTDI, which is connected to my Mac. On my android device I'm using FTDI AOA HyperTerm. I can send chars without any problem to my mac using this program: https://www.decisivetactics.com/products/serial/. As you can see I can only use it for 7 days, so I want to use my Terminal instead.
When I run this command:
screen /dev/tty.usbserial 9600
I get a blank screen with two messages, the second one being "Sorry, could not find a PTY".
What should I do to fix this?
EDIT: when I closed the Serial program, it worked on my Terminal. However, when I restart my Terminal it gives the same message.
I open Serial, select my USB device, close serial and use my Terminal.
Why is this?
I know this is old but I found the same problem today with my Raspberry PI and a PI UART card attached. I found that this error occurred when I opened up a screen session but didn't close it completely. I was able to fix by going to Activity Monitor and terminating any "screen" processes.
In my case there were no other "screen" processes running, but simply unplugging the device from the computer (i.e., USB to serial adapter) then plugging back in again cleared the issue.
I'm trying to make call for testing purposes in my bluestacks android emulator.
I tired
telnet localhost 5555
but my cmd goes blank after this.
Command prompt after telnet command
Why is it showing blank?
Is there any other way to call to an android emulator.
Edit:
I need to process incoming call in my android application, so I need to generate a fake call.
The application I'm trying to build also require root(Super User) access.
I tried using Android Studio AVD, it can make incoming calls using telnet or ddms but what I want to do requires root permission.
I tried genymotion but the free version doesn't allow calling feature.
So I'm stuck with Bluestacks, it rooted by default & I just need way to generate an actual incoming call just like
gsm call 123456789
Is there a way to fake calls for android devices that I have plugged in via usb? Some way to trigger a call using ADB? If so, how do I do it?
I feel like this might be a duplicate question but I can't find a SO question for it. This is the closest question, but it only relates to the emulator.
Here's some things I've tried. I would like to do the reverse of the following command:
adb shell am start -a android.intent.action.CALL tel:1112223333
Just like the other guy said in the question I linked to above. Except I would like to do this on a device, instead of in the emulator. For the work that I am doing the emulator is not sufficient for testing phone calls, I can only run my tests on actual devices. Our "solution" doesn't have emulator support.
So normally I would telnet into the local host using the emulator's port but I can't do that, so can I telnet into a plugged in device? Is there a way for me to fake an incoming call on a plugged in device?
To explain why I would want to do this, I am making modifications to AOSP at this time. At the moment we have not modified the emulator to work with our changes, but we are making modifications to telephony. Eventually getting the emulator to work will be important but at this time it would be ideal if we could test telephony with fake calls using the devices we have access to.
It is entirely possible that this is not even possible but if someone has experience with this I would love to know. I feel like there should be some tests somewhere for faking phone calls on devices before they release a device to the public.
Telnet to your Android device
Alternatively to adb you can also use telnet to connect to the device. This allows you to simulate certain things, e.g. incoming call, change the network connectivity, set your current geocodes, etc. Use "telnet localhost 5554" to connect to your simulated device. To exit the console session, use the quit or exit command.
For example
# connects to device
telnet localhost 5554
# set the power level
power status full
power status charging
# make a call to the device
gsm call 012041293123
# send a sms to the device
sms send 12345 Will be home soon
# set the geo location
geo fix 48 51
I'm trying to figure out how to launch an emulator with no data connection or airplane mode, either one will work. Im testing my application against data loss, however I need this to be atomized. Therefore I'm trying either to launch the emulator with no data via command line, or write bash script to launch emulator, turn data off, then run Unit Test.
RESOLVED - Per Recommendations
#! /usr/bin/expect
set timeout 10
spawn telnet localhost 5554
expect "OK"
send "gsm data off\n"
send "quit\n"
The quick and dirty way to do it could be to make an app that starts at boot and turns data off, then run the emulator and install the app. This does have potential for inconsistency however.
The other thing you can do to leave just the emulator without a network is to telnet into the emulator and turn data off. To automate it, I made a simple (and crude) example using a batch file and vbscript to feed telnet the commands since my work machine is running Windows.
The batch file:
#echo off
emulator -avd YOURAVDNAMEHERE
timeout /t 10
telnet_turn_data_off.vbs
telnet_turn_data_off.vbs:
set oShell=CreateObject("WScript.Shell")
oShell.Run "telnet localhost 5554", 9
WScript.sleep 500
oShell.Sendkeys "gsm data off{ENTER}"
WScript.sleep 500
oShell.Sendkeys "gsm voice off{ENTER}"
WScript.sleep 500
oShell.Sendkeys "quit{ENTER}"
WScript.sleep 500
oShell.Sendkeys "quit{ENTER}"
WScript.sleep 500
If running on Linux or Mac OS, expect should be able to script telnet (as seen by the edit to the question).
It is also worth noting that on older emulators (eg 2.2), turning data off might not do anything. My above example was tested with a 4.2 emulator and it appeared to cut off data properly.
I typically use physical hardware for testing instead of emulators, but if you can't find an option to enable airplane mode you could simply disconnect your computer from the internet before launching the emulator. No internet for your computer = no internet for your emulator.
Use This Following steps..
Go to Eclipse
Window->show view->other->android->Devices
now select your running emulator and Again
Go to,
Window->show view->other->android->Emulator Control
Now in that..set Data to Unregister from Home
From Device and Emulator
In Device or Emulator Go to,
Setting -> Wireless & networks -> Airplane Mode -> ok
I would like to get packet level data traffic captures (.pcap) in Android during a week (in several files if possible).
I thought that I could use tcpdump via Shark, however I find that the capture stops after some time. The biggest packet capture I got is around 40MB. I found out that tcpdump stops/crashes when changing the network interface. For example, when the phone is connected to 3G, when I run tcpdump from Shark I can see the process of tcpdump running until I switch on WiFi.
In the Galaxy S2, when connected via WiFi I have the following interfaces (got by using netcfg in adb shell): lo, svnet0, usb0, sit0, eth0. When I connect via 3G, I get pdp0 instead of eth0.
Is there any way that I can run tcpdump 24/7? Or any way to check when it is running and if it stops make it run again from a Java app? Checking the process of tcpdump or something like this maybe? Or monitoring the status of the network and running tcpdump every time the network is changed?
I had a look to: ReadLine on TCPDump-Buffer sometimes blocks until kill tcpdump , but it does not completely solve my problem.
I am using rooted devices.
How about trying tPacketCapture application ( works with non-rooted devices)
Android OS 4.0
Free
https://play.google.com/store/apps/details?id=jp.co.taosoftware.android.packetcapture
If you have rooted device then use SimplePacketCapture instead of tPacketCapture.
tPacketCapture creates a vpn that can break your voip application.
I'v tried as follow to see what's going on about tcpdump after alternating network interface.
1.open wifi run tcpdump-arm
2.run ps|grep tcpdump-arm
3.close wifi and open mobile interface
4.run ps|grep tcpdump-arm
I've found that when alternating the network interface on the mobile phone, the tcpdump-arm process is still working, but it captures no packets.
I think you need tcpdump to keep capturing even when the network interface changed.
You can catch the connectivity change broadcast as the tutorial of google says at first.
Then, you should run "killall" to kill the tcpdump processl
At last, restart the tcpdump process, if you don not specify an interface, it will listen on the newly opened interface.If you would like the tcpdump to return quickly, you can add "-l" option as the answer in TCPDump-Buffer sometimes blocks until kill tcpdump implies.