The way to detect other apps in use

Discussion in 'iOS Programming' started by chikiuso, Apr 24, 2014.

  1. chikiuso macrumors newbie

    Joined:
    Apr 24, 2014
    #1
    Hello, may I ask how to detect the other apps in use with xcode programming? For example, I need to run an app which could show what apps are running in the iphone or ipad.
     
  2. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #2
    Apple sandboxes everything, meaning you can't get info on other apps. Apple clearly has that information because they gather stats on what apps have been run and for how long. Unless you have a hook into the other apps, I really don't think you'll be able to get that information.

    I could be wrong, but I'm pretty sure Apple doesn't allow that info.
     
  3. chikiuso thread starter macrumors newbie

    Joined:
    Apr 24, 2014
    #3
    Thanks for your info, you are right, I just would like to make sure, thanks.
     
  4. D.T. macrumors 603

    D.T.

    Joined:
    Sep 15, 2011
    Location:
    Vilano Beach, FL
    #4
    If the apps you’re wanting to verify have a published URL schema, you can check if that’s available. That’s how apps know to route to an installed app (like Twitter), or to use some external default through Safari.

    For example:

    fb://
    twitter://
    imdb://

    Most are here:

    http://wiki.akosma.com/IPhone_URL_Schemes

    Do something like this using the canOpenURL method to check if there’s an app that can handle that URL/schema, then you can openURL:[] and invoke the native app, or handle the lack of the app, like so:

    Code:
    
    NSString *url = @“custom_url_schema://";
    
    if ([[UIApplication sharedApplication] canOpenURL:[NSURL url]]) {
        // open and route with custom url
    } else {
       // handle lack of schema, open in safari, notify user, etc.
    }
    
    
    This of course doesn’t detect “running” apps, and only apps with a published schema, but since I don’t know your actual design goals, I figured I’d toss it out there as a possible solution.
     

Share This Page