4

I'm developing a lockscreen application using theos and part of the functionality requires icon images of certain applications on the phone. How can I go about getting those icon images and displaying them on the lockscreen of the phone?

I've tried everything I could think of so far and have searched through the springboard headers with no luck. I've specifically been trying retrieving the images from SBApplication and SBIconModel from suggestions I found through google, but still I have no luck.

Any help is greatly appreciated. Thanks!

jacob
  • 3,507
  • 2
  • 21
  • 26

2 Answers2

5

After you %hook a class, inside the method you're using, do the following if for example you're trying to get the icon for the mail app

// Get the SBApplication for the mail app
Class $SBApplicationController = objc_getClass("SBApplicationController");
SBApplication *mailApp = [[$SBApplicationController sharedInstance] applicationWithDisplayIdentifier:@"com.apple.mobilemail"];

// Get the SBApplicationIcon for the mail app
SBApplicationIcon *mailAppIcon = [[objc_getClass("SBApplicationIcon") alloc] initWithApplication:mailApp];

The important thing is to get the right DisplayIdentifier of the app you're interested in.

Hope this help! any problems please shout.

boudarbalat
  • 181
  • 1
  • 8
  • If you're jailbroken, you can also ssh into the phone, and look at the Info.plist files in all the *.app folders. They will show the correct display identifiers (and the icon names, too). `plutil` can be useful for reading binary plists. – Nate Apr 22 '13 at 21:50
0

Although, I accept the above as the answer, I ended up using the following code, which displays titles and badges:

SBIcon *sbIcon = [model applicationIconForDisplayIdentifier:identifier];
SBIconView *app = [[%c(SBIconView) alloc] initWithDefaultSize];
[app setIcon:sbIcon];

//if you want the titles to be conditional
[app setLabelHidden:!titlesEnabled];

//if you want the badge view to be conditional
id badgeView;
if (device_version >= 6.0) badgeView = MSHookIvar<id>(app, "_accessoryView");
else badgeView = MSHookIvar<id>(app, "_badgeView");
if (badgeView) [badgeView setHidden:!badgesEnabled];
jacob
  • 3,507
  • 2
  • 21
  • 26