How to get Names of Background Running Apps
<p>I'm making an app in which i need to show the names of apps running in background. I did R&amp;D on it and came to know that we can know only about Apple's apps like Photos , Camera etc. But I couldn't know how. Please help me if you know how to get <strong>JUST NAMES OF BACKGROUND RUNNING APPS</strong>
For Background running processes I have used following Method</p>

<pre><code>- (NSArray *)runningProcesses {

    int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
    size_t miblen = 4;

    size_t size;
    int st = sysctl(mib, miblen, NULL, &amp;size, NULL, 0);

    struct kinfo_proc * process = NULL;
    struct kinfo_proc * newprocess = NULL;

    do {

        size += size / 10;
        newprocess = realloc(process, size);

        if (!newprocess){

            if (process){
                free(process);
            }   
            return nil;
        }

        process = newprocess;
        st = sysctl(mib, miblen, process, &amp;size, NULL, 0);

    } while (st == -1 &amp;&amp; errno == ENOMEM);

    if (st == 0){

        if (size % sizeof(struct kinfo_proc) == 0){
            int nprocess = size / sizeof(struct kinfo_proc);

            if (nprocess){

                NSMutableArray * array = [[NSMutableArray alloc] init];

                for (int i = nprocess - 1; i &gt;= 0; i--){

                    NSString * processID = [[NSString alloc] initWithFormat:@"%d", process[i].kp_proc.p_pid];
                    NSString * processName = [[NSString alloc] initWithFormat:@"%s", process[i].kp_proc.p_comm];

                    NSDictionary * dict = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:processID, processName, nil] 
                                                                        forKeys:[NSArray arrayWithObjects:@"ProcessID", @"ProcessName", nil]];
                    [processID release];
                    [processName release];
                    [array addObject:dict];
                    [dict release];
                }

                free(process);
                return [array autorelease];
            }
        }
    }

    return nil;
}
</code></pre>

<p>If you think its impossible then kindly have a look to this app <a href="http://itunes.apple.com/us/app/sys-activity-manager-for-memory/id447374159?mt=8" rel="nofollow">http://itunes.apple.com/us/app/sys-activity-manager-for-memory/id447374159?mt=8</a> . I have also got a solution but its not a proper way (I've mentioned in the last comment below this question).</p>

<p>Thanks.</p>
