Android Question Check if a app is running

Hello
In my app I need to check if another app is open or not
I can get the list of running apps on lower versions of Android:
B4X:
    Dim AM As ActivityManager
    Dim Info() As RunningTaskInfo = AM.GetRunningTasks
    For i = 0 To Info.Length - 1
        Log(Info(i).GetPackageName)
    Next
But this code does not work on high Androids like Android 12.
How can I get the list of running applications in all Androids? Do you need a special permission?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…