Android Question Intercept Running App

MarcoRome

Expert
Licensed User
Longtime User
Can i intercept the apps running?
Example i an app that the package is called "com.veniceartxxx" it is possible to obtain a service that when i run this app the same is intercepts
Thank you
Regards
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel thank you for your answer.
With this code i can resolve this issue:

B4X:
Dim OS As OperatingSystem : OS.Initialize("OS")
Dim ProcessName, PIDs, NamePIDs, RunningApps As List
ProcessName.Initialize : PIDs.Initialize : NamePIDs.Initialize : RunningApps.Initialize
RunningApps = OS.RunningServiceInfo(500, ProcessName, PIDs, NamePIDs)

        For i = 0 To ProcessName.Size - 1
        Dim cerca As String = ProcessName.Get(i)
                'Here part name package that you want know if run
                If cerca.Contains("venice") Then
                    Dim nome_pacchetto As String = ProcessName.Get(i)
                    If Starter.primo_tempo = False Then
                        ToastMessageShow("Found Running App", False)
                    End If
                Else
'.............

                       
                   
                End If
   
        Next

End Sub

Another alternative is THIS


Any idea to convert this code in B4A ?
Thank you
Marco
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Hi all.
I have the follow problem.
if i run this code ( look also #3 )
B4X:
....
RunningApps = OS.RunningServiceInfo(500, ProcessName, PIDs, NamePIDs)
....
I have correct result:

But if i use this code:

B4X:
RunningApps = OS.RunningAppProcessInfo(ProcessName, PIDs, NamePIDs)



i have this result:

com.mytest : 4425

Only name my package without another process.


I try also this code:
B4X:
...
OS.RunningAppProcess
....




i have this result:
android.app.ActivityManager$RunningAppProcessInfo@a9fc4cd

Now, for all Master and colleagues the question is:
Can i know a list of apps that are turning on the device ??

Another App ( as this EXAMPLE APP ) work without problem also with Android 6

Thank you
Regards
Marco
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
MarcoRome,
Did you ever figure this out? I need the same capability.
Rusty
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…