ActivityManager.getRunningTasks is deprecated android

前端 未结 5 1276
情书的邮戳
情书的邮戳 2020-12-01 05:51

I am working on push notification in android where i am using a below method to show notification, but the problem is that now ActivityManager.getRunningTasks(1); is being

5条回答
  •  隐瞒了意图╮
    2020-12-01 06:16

    This should help you get started

    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List tasks = activityManager.getAppTasks();
    
    for (ActivityManager.AppTask task : tasks) {
        Log.d(TAG, "stackId: " + task.getTaskInfo().stackId);
    }
    

提交回复
热议问题