Get foreground task on Atrix

Discussion in 'Android Hacks and Help' started by caglaroral, Feb 19, 2012.

  1. caglaroral
    Offline

    caglaroral New Member

    Joined:
    Feb 19, 2012
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Ratings:
    +1
    Hi,

    I'm trying to get the foreground task using below code.

    Code:
    ActivityManager activityManager = (ActivityManager) getSystemService(UpdateService.ACTIVITY_SERVICE);
    List<ActivityManager.RunningTaskInfo> appProcesses = activityManager.getRunningTasks(1);
    
    Log.i("MyApp", "Foreground Package: " + appProcesses.get(0).topActivity.getPackageName());
    It looks like its not working on Atrix 2.3.4. I dont have Atrix to try on

    Any ideas?
Search tags for this page

foreground data