How to get the list of background running apps in Marshmallow Devices
<p>My app shows a list of background running applications of the mobile device. When my app runs in kitkat device it is showing the list of background applications, but when it runs on marshmallow device it is showing only current app, not more than that.</p>

<p>Here is the main activity look like</p>

<pre><code>public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    TextView tv = (TextView) findViewById(R.id.text);

    ActivityManager activityManager = (ActivityManager) this
            .getSystemService(ACTIVITY_SERVICE);
    List&lt;ActivityManager.RunningAppProcessInfo&gt; procInfos = activityManager
            .getRunningAppProcesses();
    for (int idx = 0; idx &lt; procInfos.size(); idx++) {
        tv.setText(tv.getText() + "" + (idx + 1) + "."
                + procInfos.get(idx).processName + "\n");
    }
}}
</code></pre>

<p>The permission that i have declared in manifeast.xml are</p>

<pre><code>&lt;uses-permission android:name="android.permission.GET_PACKAGE_SIZE" /&gt;
&lt;uses-permission android:name="android.permission.CLEAR_APP_CACHE" /&gt;
&lt;uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /&gt;
&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
</code></pre>

<p><a href="https://i.stack.imgur.com/D8CHj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D8CHj.png" alt=""></a>
left side is the kitkat device where i'm fetching all background running applications, where as right side is the marshmallow device i'm not able fetch the background running applications.</p>