I try to change the network type from android emulator. From the official android documentation (https://developer.android.com/studio/run/emulator-commandline.html), i want to use network to change LTE/UMTS/GPRS network type. I create a new emulator from the last Android Studio 2.2 and connect with telnet. I run the help command (after authentication) and I get :
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
I don't see network as explain in the documentation and when I try to run a network command, I get an error... Anybody have already met this issue ? Any idea how to solve it ?
Ok, seems to be delete in last versions of the emulator. I hope the android team will implement this feature soon.
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=emulator%20network%20unknown&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=-id%20-stars&id=204888
Related
Is there something I can code to skip the license check when running on the emulator? i don't want to comment out as I may forget to re-enable the check when releasing to the play store. i already have a check for "isDeviceOnline()" but this call receives TRUE.
(for some reason I always get a network error in my licensing check code when running on the emulator)
If your problem is emulator is not connected to network, causing network error. May be should restart emulator and make sure you have network connection.
I generally use Genymotion's emulator and they are pretty reliable and fast.
I am looking for a way how to automate incoming calls for testing with MonkeyTalk. That means I can run some external scripts. In our Continuous Integration tool I need something capable of running in the headless mode.
WHAT I TRIED
DDMS
Telnet
ADB
DDMS from Eclipse is not the way to go as it supports only GUI.
Telnet seemed like a good choice but it's a pain in the ass to write some command line scripts for it. In Windows I didn't make it. There exists some ways in Linux though.
ADB offers only outgoing calls by using the famous
adb shell am start -a android.intent.action.CALL tel:1112223333
With ADB I also tried to invoke a broadcast with extra state ringing but NO...
QUESTION
How can I fake an incoming call to an emulator using a script? I need to set my own number, of course.
On google's android studio I think it gives you access to internet & google accounts. You could just log in, install "hangouts dialer" from the play store, then (on another phone, with a different google account) call the previously used google account. I haven't tested this though, and I don't know if the phone handles this as an actual call or just opens hangouts.
Alternatively, you could just set up two emulator instances and dial the console port number, in the window title "Android Emulator #####", as said in this question.
I find many things in DDMS Emulator Control tab, I just want to make/simulate a call from DDMS. How to do that. Also where can I find details about Emulator Control tab?
Thanx
Call as if to simulate a phone call?
1 Window > Open Perspective > DDMS
2 'Emulator Control' Tab
3 In Telephony Actions, enter any number in 'Incoming Number' textfield.
4 Choose 'Voice' from the two radiobuttons.
5 Finally, click on Call.
To disconnect, click Hang up.
More here.
Hope this helps...
I think you have received an appropriate answer for making a call to your emulator. Just refer more details about Emulator Control tab at link: http://developer.android.com/tools/debugging/ddms.html#ops-location
Take a look at Using DDMS where you will find all the required info.
You can do DDMS jobs via telnet:
Type in CMD:
telnet
open localhost 5554
sms send 000000 hello
The list of available commands:
event simulate hardware events
geo Geo-location commands
gsm GSM related commands
cdma CDMA related commands
kill kill the emulator instance
network manage network settings
power power related commands
quit|exit quit control session
redir manage port redirections
sms SMS related commands
avd control virtual device execution
window manage emulator window
qemu QEMU-specific commands
sensor manage emulator sensors
Other than DDMS, there is one more option:
The emulator automatically forwards simulated voice calls from one instance to another. To send a voice call, use the dialer application application, respectively, from one of the emulators.
To initiate a simulated voice call to another emulator instance:
1.Launch the dialer application on the originating emulator instance.
2.As the number to dial, enter the console port number of the instance you'd like to call. You can determine the console port number of the target instance by checking its window title, where the console port number is reported as "Android Emulator (<port>).
3.Press "Dial". A new inbound call appears in the target emulator instance.
First,thank you for your attention to my question
I'm planning to design an Android GPS locating application
here are my difficulties and situations
(1)my computer hardware has been out of date for a long time and running an android emulator for debugging is really time-costing,thus i bought a real device(android cellphone) one week ago,in the aim of replacing emulator during debugging
(2)i know how to send location datas to an emulator via "DDMS/Emulator Control/Location Controls",but it is disabled for a real device
(3)i am programming indoor,thus using physical gps locating function is not acceptable(even if i turn on "a-gps")
(4)i have found another topic here: Android mock location on device?
however,i can't open the detail links,like "Andrews link"," http://dehuysser.appspot.com/blog/android-developer-shell-released"
I guess these web sites are forbidden by my country......
Here are my questions:
(A)i have found some codes of making mock loation datas ,but these codes can not activate "onLocationChanged" function
However, i wonder if there is a way to send locating datas from PC to real device via USB port(i'm in USB debugging mode), just like sending locations from DDMS to emulator?
(B)i've got the information that, it is possible to send "geo fix" command to emulator as well as to a real device, by "telnet localhost ", but how to check out the port number occupied by my real device?
i know that 5554 port is used for a emulator,but what about the real device?
i've tried to command "netstat" in terminal, but it's a shame to say that i don't know which port is for my android phone......
(C)If my (A)(B) question is not practical,then what's "settings/applications/development/allow mock location" used for?
Please help me, and thank you for your answer!
I have wrote an app exactly for this (this functionality is not available on phones by default) - it's open source and provides exactly the same interface as the emulator (telnet to :5554 and run "geo fix ..." or "geo nmea"): in app store MockGeoFix
The easiest way of using mock data is using the mock test location provider API. It's at the bottom of the documentation page. I've tried it out and location is received in the onLocationChanged callback. Here is some code that you can try out.
The port used by adb is usually 5037.
I am developing a GPS enabled application on Android. There is no problem with the map display, but I want to test how my code would react to the situation in which the user enters a room, basement or a cave, so that the device would stop receiving any signal. My question is whether I can simulate this programatically or by using the DDMS, and if so, then how?
P.S. The point is to test it all on the emulator, not a real device.
Thank you.
Fixes only come into the emulator when you push them over (e.g., via the Emulator Control tab). If you don't want the emulator to receive fixes, don't send them.