Android Question Getting a List of Running Apps

Discussion in 'Android Questions' started by treehousefrog, May 11, 2015.

  1. treehousefrog

    treehousefrog Member Licensed User

    Hey guys,

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

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

       
    Dim tasks As List = o.getRecentTasks(200)
       
    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: May 11, 2015
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    NJDude likes this.
  3. treehousefrog

    treehousefrog Member Licensed User

    Haha yes I did, thanks :)
     
  4. treehousefrog

    treehousefrog Member Licensed 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!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice