Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push android application to background

Tags:

android

adb

Is it possible to push an application to the background through an adb command? I have an application which calls google navigation and I want push google navigation to the background using an adb command. I don't want to just go back to the home screen, I want make sure the app which called google navigation remains on the foreground. So far I have:

adb shell am force-stop com.google.android.apps.maps

But the above command force stops the process instead of pushing to background.

like image 833
RagHaven Avatar asked Jun 24 '13 23:06

RagHaven


1 Answers

You can send a Home key event via adb, pressing Home should put an Activity to the background:

adb shell input keyevent 3

from the docs:

public static final int KEYCODE_HOME Added in API level 1

Key code constant: Home key. This key is handled by the framework and is never delivered to applications. Constant Value: 3 (0x00000003)

possible values: http://developer.android.com/reference/android/view/KeyEvent.html

more to-the-point list: ADB Shell Input Events

like image 62
n611x007 Avatar answered Oct 13 '22 04:10

n611x007