Setting iOS background/lockscreen image programmatically?
Asked Answered
K

1

9

I'd like to be able to set the lockscreen background image programmatically. I'm aware that this is only possible for jailbroken iOS devices.

Here are some things that I've tried:

  1. Place a LockBackground.png in /private/var/mobile/Library/SpringBoard/. This works but requires a hard respring. notify_post("com.apple.language.changed"); doesn't work for a soft respring.

  2. Use class-dump to dump private methods of UIKit. UIKit in 4.2 used to have a method called + (void)setDesktopImageData:(id)fp8; but it appears to be missing in 4.3 and above.

Is there anything that I'm missing?

Kiernan answered 19/7, 2011 at 18:30 Comment(3)
Why don't you dump SpringBoard instead?Cazzie
I thought I did and didn't find anything useful.. I'll try again.Kiernan
If your interested in this question why not support the Area 51 proposal for a jail-breaking Stack Exchange siteComminate
C
12

I found this in the SpringBoard dump which I think will be of use to you:

In SBWallpaperView.h:

- (void)replaceWallpaperWithImage:(id)image;

And in SBUIController.h:

- (id)wallpaperView;

So you can do something like:

[(SBWallpaperView *)[SBUIController sharedInstance] wallpaperView] replaceWallpaperWithImage:anImage];

That's one way.

The other one I found was to use SBWallpaperView's + (void)noteWallpaperPreferencesChanged;, I'm not that sure about this one, but it seems like if you do what you did in the first thing you tried, and then use this instead of a respring, it might work.

Cazzie answered 25/7, 2011 at 5:33 Comment(4)
Where did you find these header files?Kiernan
I dumped the SpringBoard executable.Cazzie
If this answer worked for you, would you mind accepting it and giving me the the bounty?Cazzie
My bad dude, last time I used bounties it got awarded to the highest rep question. Anyway, I've accepted your answer, hope that some consolation. I haven't had a chance to test this though :(Kiernan

© 2022 - 2024 — McMap. All rights reserved.