Android Question Test for active apps running in the foreground

berndm2

Member
Licensed User
Longtime User
I would like to start an app and control it later via automatic inputs (shell-commands).
However, the controls only work correctly as long as the app is active in the foreground and is not finished or running in the background.
Is there a test option for this?
Example:
Int2 = Pm.GetApplicationIntent ("ccc71.bmw") 'Packagename via PackageName Viewer
If Int2.IsInitialized Then
StartActivity (Int2) 'Start app
End If
If ispaused (int2) = False then 'Test if app is still running
Shellcommand = "input tap 270 410" 'Touch input
Shellcommand 'Sub Shellcommand
End If
it does not work.
Thanks Jürgen
 

berndm2

Member
Licensed User
Longtime User
Thanks for the answer.
I tried it with "pgrep -l name" but the command does not distinguish between foreground and background process. However, there must be a solution, e.g. the task manager can easily distinguish between foreground and background.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…