How to use sendSMSCommand method of io.appium.java_client.android.AndroidMobileCommandHelper class

Best io.appium code snippet using io.appium.java_client.android.AndroidMobileCommandHelper.sendSMSCommand

Run io.appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

SupportsSpecialEmulatorCommands.java

Source: SupportsSpecialEmulatorCommands.java Github

copy
1package io.appium.java_client.android;
2
3import static io.appium.java_client.android.AndroidMobileCommandHelper.gsmCallCommand;
4import static io.appium.java_client.android.AndroidMobileCommandHelper.gsmSignalStrengthCommand;
5import static io.appium.java_client.android.AndroidMobileCommandHelper.gsmVoiceCommand;
6import static io.appium.java_client.android.AndroidMobileCommandHelper.networkSpeedCommand;
7import static io.appium.java_client.android.AndroidMobileCommandHelper.powerACCommand;
8import static io.appium.java_client.android.AndroidMobileCommandHelper.powerCapacityCommand;
9import static io.appium.java_client.android.AndroidMobileCommandHelper.sendSMSCommand;
10
11import io.appium.java_client.CommandExecutionHelper;
12import io.appium.java_client.ExecutesMethod;
13
14public interface SupportsSpecialEmulatorCommands extends ExecutesMethod {
15
16    /**
17     * Emulate send SMS event on the connected emulator.
18     *
19     * @param phoneNumber The phone number of message sender.
20     * @param message   The message content.
21     */
22    default void sendSMS(String phoneNumber, String message) {
23        CommandExecutionHelper.execute(this, sendSMSCommand(phoneNumber, message));
24    }
25
26    /**
27     * Emulate GSM call event on the connected emulator.
28     *
29     * @param phoneNumber The phone number of the caller.
30     * @param gsmCallActions   One of available {@link GsmCallActions} values.
31     */
32    default void makeGsmCall(String phoneNumber, GsmCallActions gsmCallActions) {
33        CommandExecutionHelper.execute(this, gsmCallCommand(phoneNumber, gsmCallActions));
34    }
35
36    /**
37     * Emulate GSM signal strength change event on the connected emulator.
38     *
39     * @param gsmSignalStrength   One of available {@link GsmSignalStrength} values.
40     */
41    default void setGsmSignalStrength(GsmSignalStrength gsmSignalStrength) {
42        CommandExecutionHelper.execute(this, gsmSignalStrengthCommand(gsmSignalStrength));
43    }
44
45    /**
46     * Emulate GSM voice event on the connected emulator.
47     *
48     * @param gsmVoiceState   One of available {@link GsmVoiceState} values.
49     */
50    default void setGsmVoice(GsmVoiceState gsmVoiceState) {
51        CommandExecutionHelper.execute(this, gsmVoiceCommand(gsmVoiceState));
52    }
53
54    /**
55     * Emulate network speed change event on the connected emulator.
56     *
57     * @param networkSpeed   One of available {@link NetworkSpeed} values.
58     */
59    default void setNetworkSpeed(NetworkSpeed networkSpeed) {
60        CommandExecutionHelper.execute(this, networkSpeedCommand(networkSpeed));
61    }
62
63    /**
64     * Emulate power capacity change on the connected emulator.
65     *
66     * @param percent   Percentage value in range [0, 100].
67     */
68    default void setPowerCapacity(int percent) {
69        CommandExecutionHelper.execute(this, powerCapacityCommand(percent));
70    }
71
72    /**
73     * Emulate power state change on the connected emulator.
74     *
75     * @param powerACState   One of available {@link PowerACState} values.
76     */
77    default void setPowerAC(PowerACState powerACState) {
78        CommandExecutionHelper.execute(this, powerACCommand(powerACState));
79    }
80
81}
82
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)