62

How can I fake an incoming call inside the android emulator?

The following lets me make a call but I'd like to force the emulator to receive a call, preferably from a number I've selected.

adb shell am start -a android.intent.action.CALL tel:1112223333

So, the direct opposite of the command above.

andy
  • 621
  • 1
  • 5
  • 3
  • 5
    I was going to comment that OP should accept an answer, but I noticed that he was last seen at the time he posted the question, not one minute later. That means he never even saw the answers.. quite a sad story – Tim Sep 22 '15 at 12:05

10 Answers10

61

You can use DDMS in Eclipse, Android Device Monitor in Android Studio or run command lines on terminal

Using DDMS:

  • Open DDMS/ADM
    • in Eclipse: Window > Open Perspective > DDMS
    • in Android Studio: Tools > Android > Android Device Monitor
  • Enter the fake incomming phone number
  • Choose "Voice"
  • Press call

enter image description here

After that, you will see the emulator receive this phone call as follows

enter image description here

Using command lines

$ telnet localhost 5554
$ gsm call 123456789

Note: 5554: console port number for emulator instance
12345678: incoming phone number

Patrick
  • 33,984
  • 10
  • 106
  • 126
Nguyen
  • 2,019
  • 1
  • 24
  • 31
  • My "Emulator Control" is disabled! I can't modify any checkbox or input field. Why? – nick Aug 04 '16 at 17:15
  • 1
    Device monitor is deprecated and removed after Android studio 3.2 https://developer.android.com/studio/profile/monitor – mili Jan 29 '19 at 00:19
  • 2
    Using latest version of Android Studio, I do not have the option: Tools > Android > Android Device Monitor Is there any new way on latest version? – Eran Friedland Feb 01 '20 at 09:29
28

Actually in android Studio 2.1 Its easy!

enter image description here

enter image description here

David Hackro
  • 3,652
  • 6
  • 41
  • 61
16

You can do this with Putty. Download and install Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/

Step 1: Run Putty

Step 2: In the address box put 127.0.0.1

In the port box put the port number your emulator is running on. It's in the top left corner of the emulator window (usually 5554). Make sure type is set to 'telnet'. Click 'Open'

Step 3: A terminal will open. Type:

gsm call <the number you want the phone to see>

Press enter and you're done.

EDIT: You can also send fake sms:

sms send <the number you want the phone to see> <the message>
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
Pop-A-Stash
  • 6,572
  • 5
  • 28
  • 54
  • For some reason on my computer, the gsm command doesn't get recognized the first time I type it in. Typing it the second time, it works fine. Not sure why. Just wanted to let you guys know. – Pop-A-Stash Dec 07 '12 at 16:01
6

if you are using eclipse then you can simply do this using emulator control for this click on window in eclipse menu then show view now click on other a small window will open select android and then emulator control

use it for making call in emulator

Jaiprakash Soni
  • 4,100
  • 5
  • 36
  • 67
  • If view is greyed out then make sure you also open the device view and click on your emulator. – HGPB Jul 09 '12 at 14:53
4

Another option for testing the same behavior is to use a real phone and Google's two step authorization settings to generate calls (see image).

voice call

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
user3251189
  • 49
  • 1
  • 4
2

There are three options which i recently checked to get simulated call on a Android emulated device (AVD).

option 1:

Go to emulated device "more" option as shown below and hit on "Call device" to get a call from number mentioned.

enter image description here

option 2:

Using emulated device UI check the phone number by going to Settings--> System --> About emulated device as shown below. Call to this number from the other device.

enter image description here

option 3:

Launch Android device monitor (e.g. on windows "C:\Users\xyz\AppData\Local\Android\Sdk\tools" launch monitor), set your own incoming number and call as shown below

enter image description here

Nafeez Quraishi
  • 5,380
  • 2
  • 27
  • 34
1

Shell script incoming_call.sh:

#!/bin/sh
expect << EOF
spawn telnet localhost 5554
expect -re ".*>"
send "gsm call $1\r"
expect -re ".*>"
send "exit\r"
EOF

Usage:

incoming_call.sh +55555555555
falko
  • 1,407
  • 14
  • 15
1

Handy one-liner on unix-like systems using telnet and netcat:

 $ echo "gsm call 123456789" | nc -v  localhost 5554
Matouš Borák
  • 15,606
  • 1
  • 42
  • 53
  • @DovidBender I was using the Android studio emulator. It uses the [5554 port by default](https://developer.android.com/studio/run/emulator-networking). – Matouš Borák Dec 04 '20 at 10:28
1

on a real device

adb shell am start -a android.intent.action.CALL -d tel:+CCXXXXXXXXXX

CC is country code , XX is phone number

dqualias
  • 348
  • 1
  • 3
  • 12
0

You can do this by connecting to your emulator via telnet.
Open Command Prompt and enter

telnet localhost <console-port>

You can find your <console-port> on the title bar of the emulator.
enter image description here

According to the above instance my <console-port> is 5554.

After connecting to the emulator via telnet, enter

gsm call <telephone-number>
Sudara
  • 4,769
  • 3
  • 34
  • 39