Fake Incoming Call Android

2019-01-08 09:32发布

问题:

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.

回答1:

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

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

Using command lines

$ telnet localhost 5554
$ gsm call 123456789

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



回答2:

Actually in android Studio 2.1 Its easy!



回答3:

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>


回答4:

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



回答5:

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).



回答6:

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

 $ echo "gsm call 123456789" | nc -v  localhost 5554


回答7:

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.

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

After connecting to the emulator via telnet, enter

gsm call <telephone-number>


回答8:

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


标签: android adb