How to test the voice call notification screen on Android in Appium

[How to test the voice call notification screen on Android]

1)add in your capabilities the name of the activity for the voice call notification screen
UiAutomator2Options options = new UiAutomator2Options();
options.setAppActivity(“Name of the activity for the voice call notification screen”);
options.setAppPackage(“package”);
to find Name of the activity for the voice call notification screen(AppActivity) and Package(AppPackage) put the page of interest on the emulator. verify that the emulator is active with adb devices then always in the promt write - adb shell dumpsys window | find “mCurrentFocus” - and take AppPackage , AppActvity and pass them.

2)Find and interact with items on the voice call notification screen. for example if you want to print the text :
WebElement callerName = driver.findElement(AppiumBy.accessibilityId(“your accessibilityId”));
String caller = callerName.getText();
System.out.println(“caller” +caller);

Here We initiate the SIP call from the web portal, and after that call is running in the native app background screen, we don’t have the IDs for that screen. Without element ids, it’s possible to click the screen and get the title for that screen.

you can inspect the elements? you could use others locators … By.xpath, className,cssSelector ecc

During inspection of the elements, only the background screen elements are captured in that inspector; the caller screen elements are not captured.

If you can’t find items using identifiers, you can try to use screen coordinates.
For example, you can use the driver.tap() to tap a certain area on the screen, which roughly corresponds to the position of the call answer or reject button in the notification pop-up.

Does this coordinate method work for all the devices? or if we need to change the coordinate settings depending on the device.

if you change device i think also coordinate will change