Android Question Getting a List of Running Apps

treehousefrog

Member
Licensed User
Longtime User
Hey guys,

So I used to use the following method to get a list of running apps with their images:

B4X:
Dim packman1 As PackageManager
Dim whichapp As String
   Dim o As OperatingSystem

   Dim tasks As List = o.getRecentTasks(20, 0)
   For Each task As Object In tasks
      Dim r As Reflector
      r.Target = task
      Dim bi As Object = r.GetField("baseIntent")
      If bi <> Null Then
         r.Target = bi
         r.Target = r.RunMethod("getComponent")
         whichapp = r.RunMethod("getPackageName")
         ToastMessageShow(whichapp, True)
      End If
      If whichapp.contains("coldfustion") = False Then
      If packman1.GetApplicationIntent(whichapp).IsInitialized Then

        Dim bitm As BitmapDrawable
bitm = packman1.GetApplicationIcon(whichapp)
mListView.AddTwoLinesAndBitmap2("", "", bitm.Bitmap, whichapp)
End If
End If
   Next

And it worked fine. Suddenly though it's stopped working and I just get a blank list. It *seems* to be since upgrading to Lollipop. I've tried to fix it with no luck. Could anyone please give me a clue as to what the issue is/how to solve it? Thanks a ton in advance!
 
Last edited:

treehousefrog

Member
Licensed User
Longtime User
After doing some more research, apparently 'getRunningTasks' is depreciated in Lollipop :-S But there must be a way to do it as other task killer apps still work...

Mysterious! If anyone has any ideas, that would be much appreciated!
 
Upvote 0
Top