Question

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!

Was it helpful?

Solution

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.

OTHER TIPS

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top