Search code examples
objective-cbundlejailbreakidentifier

Get Active Application Identifier


My question differs than the other ones, because I am coding for a jailbroken environment. The method I am editing belongs to SpringBoard and creates a system wide change, on all apps. Using this command:

[[NSBundle mainBundle] bundleIdentifier]

Only brings SpringBoard, as this method belongs under SpringBoard. So is there a way to tell which app is active in front of SpringBoard?


Solution

  • Things are way easier than what would one think. I found out that this brings the answer:

    SBApplication *front = [[objc_getClass("SpringBoard") sharedApplication] _accessibilityFrontMostApplication];
    NSString *runner = front.bundleIdentifier;