Hi Team,
Could anyone share how to read Received SMS from Android OS ?
Thanks,
Saravanan
Hi Team,
Could anyone share how to read Received SMS from Android OS ?
Thanks,
Saravanan
Hi Saravanan,
First you will have to retrieve the package name and main activity of the sms app.
To do, open your adb shell. Make sure that you open the shell for the device in question. To list the devices, run the command adb devices. in your terminal.
Once you are in the shell, to get package name for the sms app run the following command:
pm list packages -f | grep mms
OR
pm list packages -f | grep sms
You will also have to get the main activity. If you are not the developer of the app, there are several ways to obtain the main activity:
Once you obtained the package name and activity, you can launch the sms app by inserting the following command in your script:
Object result1 = driver.executeScript("client:client.launch(\"BUNDLEID\", \"false\", \"true\")");
Read the sms and obtain any values. When you want to go back to the original app, just go with the command driver.launchApp();
Or with the command that is generated inside appium studio when configuring a command for an app to launch:
driver.StartActivity("com.experitest.ExperiBank", ".LoginActivity");
Awesome!
thanks so much Nivi!