[Appium][Android] Read NFC content in an Appium session

According to https://stackoverflow.com/questions/57202157/android-nfc-read-fails-after-fullscreen-launcher-app-comes-from-background, if a device had a running process that had WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, reading NFC contents may fail.

Appium/io.appium.settings unlocks the lock screen on the device under test in the new session creation. The old method used WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD flag to achieve it. Perhaps it caused the unsuccessful NFC content read reported in https://github.com/appium/appium/issues/17973. Actually, a running process which has FLAG_DISMISS_KEYGUARD prevents device lock.

Appium/UIAutomator2 driver 2.12.1 with Appium 2.0 may fix the issue since the version’s io.appium.settings does not have the hack for old code for lower Android devices, such as lower than Android 4 etc. We hope the fix will extend the automation’s possibility.

Happy automation!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.