How to find what service running on background on Android?
like input method service, ....
Using adb or terminal on android device ?
Could I use "top" or "ps" command?
Maybe I have to ask in another way?
Does the service be presented as one "process", then we can use "ps" or "top" command to find it?
A more precise way to show running services is by using dumpsys.
To get a list of all running services:
adb shell dumpsys activity services
To show the status of a particular service:
adb shell dumpsys activity services <partial-service-name>
For example, if your service name is com.example.MyService:
adb shell dumpsys activity services MyService
If you are running the emulator or have a connected device, you can launch adb with 'adb shell' from the command line and you can run all those linux binaries like top and ps.
Related
I want to trigger a Skype call (possibly to the Echo/ Sound Test Service) via adb.
So far I was able to open skype via the following command
"adb shell am start -n com.skype.raider/com.skype4life.MainActivity"
but I could not progress further. Does anybody have any insights?
Use
adb shell am start -a android.intent.action.VIEW -d skype:echo123?call
I tried and it works.
I am running an application from ADB commands as follow:
adb shell am start -n com.example.someapp.app/.SimpleActivity
The main screen in this app will have two buttons, how can press one of these buttons from ADB Shell?
It looks like the adb shell input command might work for you. You might need to have a rooted device to allow adb simulated touch input to work.
Here's a link to a blog containing a write up on adb input:
https://grymoire.wordpress.com/2014/09/17/remote-input-shell-scripts-for-your-android-device/
You'd normally tap the button (if you know the coordinates):
adb shell input tap <x> <y>
To find coordinates, enable pointer location, then tap the button location on your device:
adb shell settings put system pointer_location 1
No need to root phone.
Tested on Android 10 API 29
Is it possible to simulate or mimic a call coming in on an Android device programmatically from the device (not connected to a computer)? I am doing a safety demo about the dangers of calls while driving and I would prefer not to have to create my own copy of the call app.
Yes you can!
Use adb for that, for emulators you can also use the android-studio tools.
adb -s <serial> shell am start -a android.intent.action.CALL -d tel:0612345678
Where <serial> should be your device or emulator id (like emulator-5555)
If you want to do it on the device itself, you can try to call yourself (yes it kind of works on most devices).
I’m looking for battery parameter in Ruby that’s tells me the usage while the app is running.
I want to take the battery status snapshot in the beginning of the run, take another snapshot in the end of the run and then calculate the usage.
Battery level status won’t give me the result that I need – the app runs are shorts in my testing and the % won’t change or won’t give me what I need.
I abled to connect to the device wireless for those tests
(the command: adb shell setprop persist.usb.chgdisabled 1 didn’t work).
The command adb shell dumpsys battery won’t give me anything.
Maybe it is the command adb shell dumpsys batteryinfo
Your thoughts?
adb shell dumpsys batterystats
Should give you the info you want.
I'm writing a python script that makes calls to adb to perform JUnit tests. I've used 'adb get-state' and 'adb wait-for-device' to wait for when the emulator is booted and ready to go, but for some reason, both of these kick off too early. After these functions return, I get this error when I start to run my tests:
android.util.AndroidException: Can't connect to activity manager; is the system running?
Is there a way I can get the status of the activity manager? If I could just poll that status that should be sufficient.
Thanks!
adb wait-for-device tells you if the adbd on the device is responsive. However, that it a linux-level daemon on the device, well below the level of the android platform which is normally started after (except in the case where ADB has just been enabled from the settings menu).
Particularly on emulators, starting up the java-level android runtime is a lengthy process, so there can be a period of seconds to minutes when adbd is responsive, but there is no ActivityManager to talk to.
After adb wait-for-server, putting an attempt to do whatever you are trying to do (presumably run the 'am' command) in a loop with a one second delay and checking the output may be the simplest solution.