i want to start an application on the phone through adb tools.
I follow this thread [Link]
[1]: How to start an application using android ADB tools? but, for example if i want to start the Angry Bird game how do i can discover the MAIN activity of package?
Thanks a lot.
If you install the app AppXplore from Google Play, you can inspect your installed applications and learn the package name and the Activities in the APK.
I've verified it just now and it worked by starting Adobe Reader from adb shell:
am start -n com.adobe.reader/com.adobe.reader.AdobeReader
We can start any application using am-:activity manager
adb shell am start android.intent.action.VIEW
adb shell am start com.android.Browser
Related
I am unable to launch Android For work enabled apps from Adb shell command?
Can some one plz give example?
Refer attached screen, I want to launch Playstore app.
Without badge ICON play store app has the same activity info with the badged playstore app as well(com.android.vending/com.google.android.finsky.activities.MainActivity).
And I am unable to launch the Badge play store activity. Please help me.
I have tried by using below command:
adb shell am start com.android.vending/com.google.android.finsky.activities.MainActivity
It is always launching Non-Badged playstore app only.
Then I have tried as per the AFW blog by Google:
https://developer.android.com/work/managed-profiles.html
adb shell pm list users
UserInfo{0:Drew:13} running
UserInfo{10:Work profile:30} running
adb shell am start --user 10 -n "com.android.vending/com.google.android.finsky.activities.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
So, I got the java.lang.SecurityException: Shell does not have permission to access user 10 error. Please someone help me.
I have found a way to launch the Apps.
Make the app in debug mode and add clearUserRestriction of the provision client as below.
dpm.clearUserRestriction(adminName,UserManager.DISALLOW_DEBUGGING_FEATURES
if we have these changes then I am able to launch the Android For Work badged apps by using the below commands. Where the --user 10 is the AFW Provisioned User.
adb shell am start --user 10 -n
"com.android.vending/com.google.android.finsky.activities.MainActivity"
-a android.intent.action.MAIN -c android.intent.category.LAUNCHER
I have tried to close android application using adb command and appium server but it is minimizing the app, not closing. I used below command for closing.
adb shell am force-stop com.package.name
AND if i try this command to kill process then it says,
adb shell kill 21860
Error:Operation omitted
Please let me know any way or command line to close android app completely, not run in background.
Thanks in advance!
I don't want to see in the background application list like below image.
adb shell am force-stop <PACKAGE-NAME>
Force stopS everything associated with <PACKAGE-NAME>
should work since honeycomb
Why not just:
un-installing app (it will stop any service or running process of it):
adb -s <udid> uninstall <appPackage>
and then installing it again:
adb -s <udid> install <apkPath>
Note:
In my case it is not working, because my app need to be registered each time re-installed, and working around it with 3rd app (e.g. Appium) is taking too long.
I want to launch the App Info screen for my app through adb. I tried to fire an intent using "adb shell am start" but nothing seems to work. I need something that works at least for API levels 18 and 19. Can anyone help?
Open App Info
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS package:com.your.packagename
For Example: if you want to open Chrome App Info
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS package:com.android.chrome
adb shell am start -n yourpackagename/.activityname
I would like to crash my Android app by using command-line ADB tool during my app is running, is it possible to do? and how ?
(Basically, I want to test if my app persist the necessary informations when it is crashed. So, I would like to demo this by crash my app by some command-line tool, like ADB.)
***** Update ********
In other words, how to kill my app process by using ADB tool?
kill probably won't work.
adb shell am force-stop <your.app.package>
adb shell kill <PID>
Try the below command in abd shell.
You can kill your app from the shell:
adb -s YOURDEVICEID shell
top // find your app pid
kill -p YOUR_APP_PID
I can easily kill my app from Eclipse DDMS. Just stop the process , e.g. stop "com.my.app"
You can actually trigger a crash via the "crash" param to adb shell am
adb shell am crash <package name>
This is an obscure option but can be confirmed when emulator is running via: adb shell am help
Details: reference
crash [--user <USER_ID>] <PACKAGE|PID>
Induce a VM crash in the specified package or process
Wish this was easier to find I cannot find the original source where I found it but should be more obviously listed on docs page vs only shown when connected am help menu...
https://developer.android.com/studio/command-line/adb#am
App crashing at runtime is nothing but an Occurance of Exception, The place after which you want to crash your app, write a logic which causes for an Exception.
The best way to crash your app is to add an Exception to your package.
Like division by 0 - add it to your app code.
I don't know if you've got the answer yet. The answer is pretty much the same as #bas but instead of using , you need to you the package name
adb shell am force-stop <package name>
you can get the package name by using this command
adb shell pm list package -3
-3 means all 3rd party apps that are installed in device.
How do I launch any application via a terminal or command shell on android emulator engine? For example, if I want to start any game, how do I do via a terminal or command shell?
Anyone could help is really appreciated.
Thanks,
Sam.
You can use the am start command trough adb.
Example for the browser app floating around the internet:
am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity