简体   繁体   中英

ADB command to resume android app to foreground without knowing activity

我想在不知道当前活动的情况下通过包名将后台应用程序带到前台。

You can achieve this by calling driver.activateApp(package-name); see this for more details

Yes. It's possible to run application specifying package name only using monkey tool by follow this pattern:

adb shell monkey -p your.app.package.name -c android.intent.category.LAUNCHER 1

Command is used to run app using monkey tool which generates random input for application. The last part of command is integer which specify the number of generated random input for app. In this case the number is 1, which in fact is used to launch the app (icon click) .

More simplify version of adb command:

android.intent.category.LAUNCHER is default as it is part of Andriod OS. so You can simplify it

adb shell monkey -p your.app.package.name 1

Hope it will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM