Wednesday, July 27, 2022

[SOLVED] Use android adb shell to return one activity

Issue

I have the following problem:

Our company manufactured a android device that have no return button (not physical and not at the bottom of the screen), so I can't return to the previous activity/screen. Now I need to test an App developed by a third-party that only save settings when I return to the previous screen.

Is there any way I can return to the previous screen or emulate a user clicking the return button?

I found this to return to HOME (Android main screen):

adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME

Also read about Activity Manager and Exerciser Monkey on these links:

http://developer.android.com/tools/help/adb.html#am

http://developer.android.com/tools/help/monkey.html

But wasn't able to solve my problem. Anybody knows how to accomplish this call using adb?


Solution

you might want to try:

adb shell input keyevent KEYCODE_BACK

cf. KEYCODE_BACK event



Answered By - ligi
Answer Checked By - Marie Seifert (WPSolving Admin)