Faking an Incoming Call on the Android Emulator

Faking an Incoming Call on the Android Emulator

22 April 2024 Stephan Petzl Leave a comment Tech-Help

Developing and testing Android applications often requires simulating different scenarios that a user may encounter. One such scenario is receiving an incoming call. Testing this functionality can be crucial for applications that handle calls, notifications, or manage states during interruptions.

In this guide, we will walk through the process of simulating an incoming call on the Android emulator.

Simulating a Call via Android Device Monitor

The Android Device Monitor provides a graphical interface for simulating an incoming call to the emulator. Here’s how to use it:

  1. Open the Android Device Monitor:
    • In Eclipse: Navigate to Window > Open Perspective > DDMS.
    • In Android Studio: Go to Tools > Android > Android Device Monitor.
  2. Once the monitor is open, enter the fake incoming phone number.
  3. Select the “Voice” call type.
  4. Click the “Call” button to initiate the call.

The emulator will display the incoming call from the number you provided.

Using Command Lines for Call Simulation

If you prefer using command lines, you can simulate an incoming call via terminal or command prompt:

  1. Open your terminal or command prompt.
  2. Connect to the emulator using telnet:
    telnet localhost [emulator_port]
  3. Initiate a GSM call with the desired number:
    gsm call [phone_number]

Note: Replace [emulator_port] with your emulator instance’s console port number (default is 5554) and [phone_number] with the incoming phone number you wish to simulate.

Alternative Methods

Other methods include:

  • Using Putty or similar terminal emulators to establish a telnet connection and simulate the call.
  • Utilizing shell scripts or one-liners on Unix-like systems to quickly send commands to the emulator.

How “Repeato” Can Help

While simulating incoming calls is useful, ensuring that your application consistently behaves as expected is where automated testing shines. This is where “Repeato” comes into play.

Repeato is a No-code test automation tool that can help you automate the testing of your app’s behavior during incoming calls. With its AI-powered computer vision, Repeato allows you to create tests that can interact with your application as a user would, even when a simulated call is occurring.

Moreover, Repeato’s compatibility with various app frameworks and the inclusion of ADB commands makes it a versatile choice for comprehensive app testing, ensuring that your application remains robust in all use cases.

Like this article? there’s more where that came from!