简体   繁体   English

假来电Android

[英]Fake Incoming Call Android

How can I fake an incoming call inside the android emulator? 如何伪造android模拟器中的来电?

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. 所以,与上面的命令正好相反。

You can use DDMS in Eclipse, Android Device Monitor in Android Studio or run command lines on terminal 您可以在Eclipse中使用DDMS,在Android Studio中使用Android Device Monitor或在终端上运行命令行

Using DDMS: 使用DDMS:

  • Open DDMS/ADM 打开DDMS / ADM
    • in Eclipse: Window > Open Perspective > DDMS 在Eclipse中:Window> Open Perspective> DDMS
    • in Android Studio: Tools > Android > Android Device Monitor 在Android Studio中:工具> Android> Android设备监视器
  • 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 $ telnet localhost 5554
$ gsm call 123456789 $ gsm致电123456789

Note: 5554: console port number for emulator instance 注意:5554:模拟器实例的控制台端口号
12345678: incoming phone number 12345678:来电号码

Actually in android Studio 2.1 Its easy! 实际上在android Studio 2.1中很容易!

在此输入图像描述

在此输入图像描述

You can do this with Putty. 你可以用Putty做到这一点。 Download and install Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/ 下载并安装Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/

Step 1 : Run Putty 第1步 :运行Putty

Step 2 : In the address box put 127.0.0.1 第2步 :在地址栏中输入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). 它位于模拟器窗口的左上角(通常为5554)。 Make sure type is set to 'telnet'. 确保将type设置为'telnet'。 Click 'Open' 点击“打开”

Step 3 : A terminal will open. 第3步 :终端将打开。 Type: 类型:

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

Press enter and you're done. 按Enter键即可完成。

EDIT: You can also send fake sms: 编辑:你也可以发送假短信:

sms send <the number you want the phone to see> <the message>

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 如果你正在使用eclipse那么你可以简单地使用模拟器控制这个点击eclipse菜单中的窗口然后显示视图现在点击其他一个小窗口将打开选择android然后模拟器控制

use it for making call in emulator 用它在模拟器中进行调用

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). 测试相同行为的另一个选择是使用真实手机和Google的两步授权设置来生成呼叫(请参阅图像)。

语音通话

使用telnet和netcat在类似unix的系统上使用方便的单行程序:

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

You can do this by connecting to your emulator via telnet. 您可以通过telnet连接到您的模拟器来完成此操作。
Open Command Prompt and enter 打开命令提示符并输入

telnet localhost <console-port>

You can find your <console-port> on the title bar of the emulator. 您可以在模拟器的标题栏上找到<console-port>
在此输入图像描述

According to the above instance my <console-port> is 5554. 根据上面的例子,我的<console-port>是5554。

After connecting to the emulator via telnet, enter 通过telnet连接到模拟器后,输入

gsm call <telephone-number>

Shell script incoming_call.sh : Shell脚本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

There are three options which i recently checked to get simulated call on a Android emulated device (AVD). 我最近检查了三个选项,以便在Android模拟设备(AVD)上进行模拟调用。

option 1: 选项1:

Go to emulated device "more" option as shown below and hit on "Call device" to get a call from number mentioned. 转到模拟设备“更多”选项,如下所示,然后点击“呼叫设备”以从提到的号码拨打电话。

在此输入图像描述

option 2: 选项2:

Using emulated device UI check the phone number by going to Settings--> System --> About emulated device as shown below. 使用模拟设备UI通过转至设置 - >系统 - >关于模拟设备来检查电话号码,如下所示。 Call to this number from the other device. 从其他设备拨打此号码。

在此输入图像描述

option 3: 选项3:

Launch Android device monitor (eg on windows "C:\\Users\\xyz\\AppData\\Local\\Android\\Sdk\\tools" launch monitor), set your own incoming number and call as shown below 启动Android设备监视器(例如在Windows“C:\\ Users \\ xyz \\ AppData \\ Local \\ Android \\ Sdk \\ tools”启动监视器上),设置您自己的传入号码并调用如下所示

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM