service+ActivityManager....

 

        ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        List
<RunningTaskInfo> TaskList = am.getRunningTasks(2);
        
if(TaskList == null || TaskList.isEmpty())
                
return;
        
        RunningTaskInfo rti 
= TaskList.get(0);
   
        String tmp 
= rti.topActivity.getPackageName();
-------

        tmp就是包名 

 posted on 2011-06-18 11:05  清水湾  阅读(310)  评论(0编辑  收藏  举报