• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Checking if other activities are launched\running

AsafKov

Newbie
Hi everyone,
I've been searching for a way to monitor over other apps, specifically check if certain apps have been launched\are running.
From what I could find, ActivityManager seemed like that way to go, using getRunningTasks() or getRunningAppProcess(), but it seems any relevant function has either been deprecated or limited to give information only on the app that's running it.

So it seems kinda impossible to do now (and I read on Stackoverflow people saying as much) but then how are apps such as AppBlock operate? (apps that block other apps\ask for password on entry)
Is there an alternative way for doing this? (Wherever I looked, people offered the exact same solution that is out of date).
 
Just out of interest, what happens if you open an adb session to the device, and issue the command

Code:
ps -elf

if that lists all running processes, then you could use an 'exec' system call in your application code to run that command.
 
Just out of interest, what happens if you open an adb session to the device, and issue the command

Code:
ps -elf

if that lists all running processes, then you could use an 'exec' system call in your application code to run that command.

I should mention that this solution works great, but for root apps only.
 
Back
Top Bottom